diff options
author | Felipe Menteiro de Carvalho <sekelsenmat@users.sourceforge.net> | 2007-05-17 05:55:12 +0000 |
---|---|---|
committer | Felipe Menteiro de Carvalho <sekelsenmat@users.sourceforge.net> | 2007-05-17 05:55:12 +0000 |
commit | fe73e95e263dbffa96386ab1aa2b3cd7a78e66dc (patch) | |
tree | ab3573d1bf29ff93c421fb893172579c33c61ceb /gfx/gdi/gfx_gdi.pas | |
parent | 866f4fc3e3b682cae67091413d18c62bb5cdddd3 (diff) | |
download | fpGUI-fe73e95e263dbffa96386ab1aa2b3cd7a78e66dc.tar.xz |
Improved form freeing code and general handling of GFApplication.Forms
Diffstat (limited to 'gfx/gdi/gfx_gdi.pas')
-rw-r--r-- | gfx/gdi/gfx_gdi.pas | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gfx/gdi/gfx_gdi.pas b/gfx/gdi/gfx_gdi.pas index ddbc1d1b..7964f222 100644 --- a/gfx/gdi/gfx_gdi.pas +++ b/gfx/gdi/gfx_gdi.pas @@ -1020,8 +1020,7 @@ begin Windows.ReleaseDC(0, TempDC); end; -function TGDIScreen.CreateMonoBitmapCanvas(AWidth, AHeight: Integer - ): TFCustomCanvas; +function TGDIScreen.CreateMonoBitmapCanvas(AWidth, AHeight: Integer): TFCustomCanvas; var TempDC: HDC; begin @@ -1040,13 +1039,10 @@ begin end; +{ Itīs not the job of the Application object to clean up undestroyed forms + This can generate crashes } destructor TGDIApplication.Destroy; -var - i: Integer; begin - for i := 0 to Forms.Count - 1 do - TGDIWindow(Forms[i]).Free; - inherited Destroy; end; @@ -1156,11 +1152,15 @@ begin Event.EventType := etShow; Window.ProcessEvent(Event); + + GFApplication.AddWindow(Window); end else begin Event.EventType := etHide; Window.ProcessEvent(Event); + + GFApplication.RemoveWindow(Window); end; end; WM_Move: @@ -1406,10 +1406,10 @@ begin Windows.DestroyWindow(OldHandle); end; - GFApplication.Forms.Remove(Self); + GFApplication.RemoveWindow(Self); // Are we the last window for our owning application? - if GFApplication.Forms.Count = 0 then + if (GFApplication.QuitWhenLastWindowCloses and (GFApplication.Forms.Count = 0)) then Windows.PostQuitMessage(0); inherited Destroy; |