• Welcome to PlanetSquires Forums.
 

WinFBE 1.4.1 on GitHub (August 3, 2017)

Started by Paul Squires, August 02, 2017, 04:43:54 PM

Previous topic - Next topic

Paul Squires

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Updated the FreeBasic project thread for WinFBE  http://www.freebasic.net/forum/viewtopic.php?f=8&p=234739#p234739
Added a shout out for Jose's awesome CWindow and class libraries.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

Thanks for the shout out.

You must check the code for Find/Replace. There must be a memory leak somewhere. The number of GDI objects in the Task Manager increases by more than 400 each time that I use it and eventually the editor stops working.

Paul Squires

Thanks Jose, I will investigate this today and track down the GDI leak. I'll post an update once it is corrected.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

From time to time I get a "Permission denied" message from the linker. This was also happening with previous versions of the editor.

Paul Squires

Quote from: Jose Roca on August 03, 2017, 11:37:38 PM
Thanks for the shout out.

You must check the code for Find/Replace. There must be a memory leak somewhere. The number of GDI objects in the Task Manager increases by more than 400 each time that I use it and eventually the editor stops working.


This appears to be related to me using GDI function to load png from resource but not releasing those pointer handles when subsequent calls to load additional images. I need to use GdiDispose (which I wasn't doing).
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Quote from: Jose Roca on August 04, 2017, 01:49:09 PM
From time to time I get a "Permission denied" message from the linker. This was also happening with previous versions of the editor.

This has happened to me also from time to time. Would love to be able to faithfully reproduce the circumstances that cause it.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Quote from: TechSupport on August 04, 2017, 03:12:46 PM
Quote from: Jose Roca on August 03, 2017, 11:37:38 PM
Thanks for the shout out.

You must check the code for Find/Replace. There must be a memory leak somewhere. The number of GDI objects in the Task Manager increases by more than 400 each time that I use it and eventually the editor stops working.


This appears to be related to me using GDI function to load png from resource but not releasing those pointer handles when subsequent calls to load additional images. I need to use GdiDispose (which I wasn't doing).


Actually, this is not the case at all. I am using icons, not png for the find/replace graphics. Looks like I was using DeleteObject rather than DestroyIcon. Making the change helps considerable but there is still a 20 or 30 gdi leak each time the dialog is invoked. I am still investigating that.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Quote from: Jose Roca on August 03, 2017, 11:37:38 PM
Thanks for the shout out.

You must check the code for Find/Replace. There must be a memory leak somewhere. The number of GDI objects in the Task Manager increases by more than 400 each time that I use it and eventually the editor stops working.


Rarely do programming problems kick my ass as badly as this problem did. It took me hours to finally track down the source of the leak. Had really not much to do with the icons at all. There were two main problems:

1) Not DELETE the allocated pWindow memory for the main frmFindReplace dialog every time it was open and closed. Of course this prevented the destructor for each instance of the pWindow from firing.

2) For every child image button on the frmFindReplace dialog I was assigning a tooltip. However, I was not destroying the HWND window associated with the tooltip during the WM_DESTROY of each image button.

Things seem to be good now with the GDI resources.

As an aside, instead of tracking the GDI resources with the Windows Task Manager, it was much easier to display the GDI cound in the WinFBE task bar using a timer that fired every 500ms.


      if uMsg.message = WM_TIMER then
         Dim As HWnd hStatusbar = GetDlgItem(HWnd_FRMMAIN, IDC_FRMMAIN_STATUSBAR)
         static GUILeak as wstring * 100
         dim hProcess AS HANDLE
         dim dwProcessID as dword
         getwindowthreadprocessid( HWnd_FRMMAIN, @dwProcessID)
         hProcess = openprocess(PROCESS_QUERY_INFORMATION OR PROCESS_VM_READ, 0, dwProcessID)
         GUILeak = "GDICount: " & str(getguiresources(hProcess, GR_GDIOBJECTS))
         StatusBar_SetText(hStatusbar, 0, GUILeak)
      end if



I am uploading the new version (1.4.2) to GitHub and will post the release details.

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca


José Roca

And apparenty you also have fixed the problem of DebugView reporting a bunch of wrong API calls. Maybe it was caused by the wrong use of DeleteObject rather than DestroyIcon.

Paul Squires

I'm working on adding the User Tools dialog (attached). Similar to the functionality in FireFly.

Jose, anything you need added? I'm thinking that after this dialog that I should concentrate on improving the codetips/completion. Most likely implement it with threads to monitor code as it is typed rather than doing the parse whenever the source file is saved. I want to switch to use your dictionary code rather than the primitive db system I cobbled together within the editor.

I also want to get back at the GUI library that I am building on top of your CWindow and classes. I have a strong feeling that if I can present a .dot style framework with all of the flexibility and speed that your framework provides then there would be much more uptake from Windows programmers in the FB world.

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

#42
In the tools manager that I did for my editor, I have a checkbox labeled "Display this item in the editor menu". When the editor starts, it reads the database and displays the checked items in a Tools menu and, if the extension is .chm, it does it in the Guides menu.

José Roca

Quote
I also want to get back at the GUI library that I am building on top of your CWindow and classes. I have a strong feeling that if I can present a .dot style framework with all of the flexibility and speed that your framework provides then there would be much more uptake from Windows programmers in the FB world.

With so many VBer's wandering around, I won't be surprised. The pity is that coding this way they will never learn to use the Windows API, and what would be of them without the SDK programmers?

Many years ago I read something like C++ programmers should be gratefully indebted to the designers of VB because they had provided them with a good way of earning money writing OCXs for VB.

Paul Squires

Quote from: Jose Roca on August 06, 2017, 02:46:18 PM
Many years ago I read something like C++ programmers should be gratefully indebted to the designers of VB because they had provided them with a good way of earning money writing OCXs for VB.

:D  That's so true, and I was one of those poor souls who started Windows programming using VB. I learned WinAPI and GUI programming when I switched to PB and starting coding the JellyFish editor. Seems like a lifetime ago now!
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer