mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 05:56:02 +02:00
lcl: destroy ThemeServices in the TWidgetset.BeforeDestruction method since it can release some gdi objects and some widgetsets (like gtk) stores gdi objects in internal structures and release them in the widgetset destructor
git-svn-id: trunk@19212 -
This commit is contained in:
parent
91dea6fbf8
commit
6f99c2aab0
@ -13,7 +13,7 @@
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
@ -29,10 +29,10 @@ begin
|
||||
FThemeServices := CreateThemeServices;
|
||||
end;
|
||||
|
||||
destructor TWidgetSet.Destroy;
|
||||
procedure TWidgetSet.BeforeDestruction;
|
||||
begin
|
||||
FreeAndNil(FThemeServices);
|
||||
inherited Destroy;
|
||||
FreeAndNil(FThemeServices); // destroy before destructor to release resources
|
||||
inherited BeforeDestruction;
|
||||
end;
|
||||
|
||||
procedure TWidgetSet.PassCmdLineOptions;
|
||||
|
@ -87,7 +87,7 @@ type
|
||||
function CreateThemeServices: TThemeServices; virtual;
|
||||
public
|
||||
constructor Create; virtual;
|
||||
destructor Destroy; override;
|
||||
procedure BeforeDestruction;override;
|
||||
|
||||
procedure AppInit(var ScreenInfo: TScreenInfo); virtual; abstract;
|
||||
procedure AppRun(const ALoop: TApplicationMainLoop); virtual;
|
||||
|
@ -472,6 +472,7 @@ type
|
||||
procedure PaintBorder(Control: TObject; EraseLRCorner: Boolean); virtual;
|
||||
procedure UpdateThemes;
|
||||
|
||||
property DottedBrush: HBRUSH read GetDottedBrush;
|
||||
property ThemesAvailable: Boolean read FThemesAvailable;
|
||||
property ThemesEnabled: Boolean read GetThemesEnabled;
|
||||
|
||||
@ -1875,7 +1876,7 @@ procedure TThemeServices.DrawElement(DC: HDC; Details: TThemedElementDetails; co
|
||||
begin
|
||||
OldColor1 := SetBkColor(DC, ColorToRGB(Color1));
|
||||
OldColor2 := SetTextColor(DC, ColorToRGB(Color2));
|
||||
FillRect(DC, ARect, GetDottedBrush);
|
||||
FillRect(DC, ARect, DottedBrush);
|
||||
SetBkColor(DC, OldColor1);
|
||||
SetTextColor(DC, OldColor2);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user