mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 21:30:34 +02:00
Carbon: fixed crash with menu item of trayicon on MacOsX Lion. issue #19693
git-svn-id: trunk@31598 -
This commit is contained in:
parent
e121294b60
commit
880fd18517
@ -426,7 +426,7 @@ var
|
||||
AMenuItem: NSMenuItem;
|
||||
LCLMenu: TMenuItem;
|
||||
begin
|
||||
AMenuItem := NSMenuItem.CreateWithHandle(sender);
|
||||
AMenuItem := NSMenuItem.CreateWithHandle(lobjc.id(_cmd));
|
||||
LCLMenu := TMenuItem(PtrInt(AMenuItem.Tag()));
|
||||
if (LCLMenu <> nil) and Assigned(LCLMenu.OnClick) then LCLMenu.OnClick(LCLMenu);
|
||||
end;
|
||||
@ -501,7 +501,8 @@ begin
|
||||
|
||||
APrivateTrayIcon.item := NSStatusItem.CreateWithHandle(APrivateTrayIcon.bar.statusItemWithLength(NSSquareStatusItemLength));
|
||||
APrivateTrayIcon.item.retain();
|
||||
APrivateTrayIcon.item.setImage(APrivateTrayIcon.image.Handle);
|
||||
if Assigned(APrivateTrayIcon.image) and Assigned(APrivateTrayIcon.Image.Handle) then
|
||||
APrivateTrayIcon.item.setImage(APrivateTrayIcon.image.Handle);
|
||||
APrivateTrayIcon.item.setHighlightMode(LongBool(YES));
|
||||
|
||||
{ Inserts the menu }
|
||||
@ -540,10 +541,14 @@ begin
|
||||
|
||||
{ Updates the image }
|
||||
|
||||
APrivateTrayIcon.image.Free;
|
||||
if Assigned(APrivateTrayIcon.Image) then
|
||||
APrivateTrayIcon.image.Free;
|
||||
|
||||
APrivateTrayIcon.image := APrivateTrayIcon.ConvertTIconToNSImage(ATrayIcon.Icon);
|
||||
APrivateTrayIcon.item.setImage(APrivateTrayIcon.image.Handle);
|
||||
if Assigned(ATrayIcon.Icon) then
|
||||
begin
|
||||
APrivateTrayIcon.image := APrivateTrayIcon.ConvertTIconToNSImage(ATrayIcon.Icon);
|
||||
APrivateTrayIcon.item.setImage(APrivateTrayIcon.image.Handle);
|
||||
end;
|
||||
|
||||
{ Inserts the menu }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user