Browse Source

remove control from theme on destroy

Johann ELSASS 5 years ago
parent
commit
d2760ae67d
1 changed files with 8 additions and 0 deletions
  1. 8 0
      bgratheme.pas

+ 8 - 0
bgratheme.pas

@@ -47,6 +47,8 @@ type
   private
     FTheme: TBGRATheme;
     procedure SetTheme(AValue: TBGRATheme);
+  public
+    destructor Destroy; override;
   published
     property Theme: TBGRATheme read FTheme write SetTheme;
   end;
@@ -106,6 +108,12 @@ begin
   Invalidate;
 end;
 
+destructor TBGRAThemeControl.Destroy;
+begin
+  if Assigned(FTheme) then FTheme.RemoveThemedControl(self);
+  inherited Destroy;
+end;
+
 { TBGRAThemeSurface }
 
 function TBGRAThemeSurface.GetBitmap: TBGRABitmap;