diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-01-21 11:18:44 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-01-21 11:18:44 +0000 |
commit | 8d23789d877af358edb1aeca75e42e6953f0179f (patch) | |
tree | 9a4c6e10c001b782d38b63446f02e4073f2f9e33 /src/corelib/x11 | |
parent | aa2a6e1dac26b8813891b23f14dccbc476329fec (diff) | |
download | fpGUI-8d23789d877af358edb1aeca75e42e6953f0179f.tar.xz |
* Fixed some memory leaks in TfpgComboBox.
* Fixed the destruction order of TfpgComboBox.
* Introduced DoRemoveWindowLookup() in gfxbase.pas so that we
can offload some of the responsibility from DoReleaseWindowHandle()
* Add two new debug methods to help debug fpGUI and fpGUI based
applications. They are PrintCallTrace() and PrintCallTraceDbgln().
* Fixed 'Index out of bounds' error when quiting your application.
* I included lots of debug output in this revision, so I can test
under Windows. As soon as I confirmed everything works, I'll
remove the debug output again.
Diffstat (limited to 'src/corelib/x11')
-rw-r--r-- | src/corelib/x11/gfx_x11.pas | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas index a7b37812..a8cbe44a 100644 --- a/src/corelib/x11/gfx_x11.pas +++ b/src/corelib/x11/gfx_x11.pas @@ -134,6 +134,7 @@ type FModalForWin: TfpgWindowImpl; procedure DoAllocateWindowHandle(AParent: TfpgWindowBase); override; procedure DoReleaseWindowHandle; override; + procedure DoRemoveWindowLookup; override; procedure DoSetWindowVisible(const AValue: Boolean); override; function HandleIsValid: boolean; override; procedure DoSetWindowTitle(const ATitle: string); override; @@ -734,8 +735,10 @@ begin Popup := PopupListFirst; -// WriteLn('Event ',GetXEventName(ev._type),': ', ev._type,' window: ', ev.xany.window); + {$IFDEF DEBUG} + WriteLn('Event ',GetXEventName(ev._type),': ', ev._type,' window: ', ev.xany.window); // PrintKeyEvent(ev); { debug purposes only } + {$ENDIF} case ev._type of X.KeyPress, @@ -1182,17 +1185,30 @@ begin end; procedure TfpgWindowImpl.DoReleaseWindowHandle; +var + lCallTrace: IInterface; begin - if FWinHandle <= 0 then - Exit; - - XDestroyWindow(xapplication.Display, FWinHandle); - // RemoveWindowLookup is now deferred to DestroyNotify event. -// RemoveWindowLookup(self); + lCallTrace := PrintCallTrace(Classname, 'DoReleaseWindowHandle: ' + Name); + if HandleIsValid then + begin + PrintCallTraceDbgLn('XDestroyWindow'); + XDestroyWindow(xapplication.Display, FWinHandle); + end + else + begin + PrintCallTraceDbgLn(' RemoveWindowLookup'); + RemoveWindowLookup(self); + end; FWinHandle := 0; end; +procedure TfpgWindowImpl.DoRemoveWindowLookup; +begin + PrintCallTraceDbgLn('RemoveWindowLookup ' + Name + ' [' + Classname + ']'); + RemoveWindowLookup(self); +end; + procedure TfpgWindowImpl.DoSetWindowVisible(const AValue: Boolean); begin if AValue then |