mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-06 20:00:17 +02:00
(Qt): fix TPopupMenu mem leak
git-svn-id: trunk@11886 -
This commit is contained in:
parent
184385e598
commit
45cafe9489
@ -240,6 +240,8 @@ end;
|
||||
Dealocates a Menu Item
|
||||
------------------------------------------------------------------------------}
|
||||
class procedure TQtWSMenuItem.DestroyHandle(const AMenuItem: TMenuItem);
|
||||
var
|
||||
Obj: TObject;
|
||||
begin
|
||||
{$ifdef VerboseQt}
|
||||
Write('[TQtWSMenuItem.DestroyHandle] Caption: ' + AMenuItem.Caption);
|
||||
@ -249,18 +251,9 @@ begin
|
||||
WriteLn('');
|
||||
{$endif}
|
||||
|
||||
{ Apparently LCL tries to dealocate the handle of the menu item internal to TMenu,
|
||||
but it doesn´t create a handle for it. Instead it just put´s the handle of the TMenu
|
||||
on that item.
|
||||
We can detect this menu item checking if HasParent is false }
|
||||
if AMenuItem.HasParent then
|
||||
begin
|
||||
{ Here the menu item has a QMenuH handle
|
||||
Obs: Commented because they cause access violations inside Qt
|
||||
library on the Virtual Magnifying Glass
|
||||
}
|
||||
TQtMenu(AMenuItem.Handle).Free;
|
||||
end;
|
||||
Obj := TObject(AMenuItem.Handle);
|
||||
if Obj is TQtMenu then
|
||||
Obj.Free;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -70,7 +70,7 @@ type
|
||||
|
||||
TWSMenuClass = class of TWSMenu;
|
||||
TWSMenu = class(TWSLCLComponent)
|
||||
class function CreateHandle(const AMenu: TMenu): HMENU; virtual;
|
||||
class function CreateHandle(const AMenu: TMenu): HMENU; virtual;
|
||||
class procedure BiDiModeChanged(const AMenu: TMenu); virtual;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user