You've already forked lazarus-ccr
SpkToolbar: Fix crash when a popupmenu used by a button is destroyed.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8962 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -15,7 +15,7 @@ unit spkt_Items;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uses LazLoggerBase,
|
||||
Classes, Controls, SysUtils, Dialogs,
|
||||
spkt_Appearance, spkt_Dispatch, spkt_BaseItem, spkt_Types,
|
||||
spkt_Buttons, spkt_Checkboxes;
|
||||
@ -102,11 +102,17 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSpkItems.Notify(Item: TComponent; Operation: TOperation);
|
||||
var
|
||||
i: Integer;
|
||||
baseItem: TSpkBaseItem;
|
||||
begin
|
||||
inherited Notify(Item, Operation);
|
||||
|
||||
DebugLn('[TSpkItems.Notify] Removing ' + Item.ClassName);
|
||||
|
||||
case Operation of
|
||||
opInsert:
|
||||
if Item is TSpkBaseItem then
|
||||
begin
|
||||
// Setting the dispatcher to nil will cause that during the ownership
|
||||
// assignment, the Notify method will not be called
|
||||
@ -122,17 +128,23 @@ begin
|
||||
end;
|
||||
|
||||
opRemove:
|
||||
if not (csDestroying in Item.ComponentState) then
|
||||
if Item is TSpkBaseItem then
|
||||
begin
|
||||
TSpkBaseItem(Item).ToolbarDispatch := nil;
|
||||
TSpkBaseItem(Item).Appearance := nil;
|
||||
TSpkBaseItem(Item).Images := nil;
|
||||
TSpkBaseItem(Item).DisabledImages := nil;
|
||||
TSpkBaseItem(Item).LargeImages := nil;
|
||||
TSpkBaseItem(Item).DisabledLargeImages := nil;
|
||||
// TSpkBaseitem(Item).ImagesWidth := 0;
|
||||
// TSpkBaseItem(Item).LargeImagesWidth := 0;
|
||||
end;
|
||||
if not (csDestroying in Item.ComponentState) then
|
||||
begin
|
||||
TSpkBaseItem(Item).ToolbarDispatch := nil;
|
||||
TSpkBaseItem(Item).Appearance := nil;
|
||||
TSpkBaseItem(Item).Images := nil;
|
||||
TSpkBaseItem(Item).DisabledImages := nil;
|
||||
TSpkBaseItem(Item).LargeImages := nil;
|
||||
TSpkBaseItem(Item).DisabledLargeImages := nil;
|
||||
end;
|
||||
end else
|
||||
for i := 0 to Count-1 do
|
||||
begin
|
||||
baseItem := Items[i];
|
||||
baseItem.Notify(Item, Operation);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user