mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-09 21:39:19 +02:00
Patch from bug #19253: LCL in dylib crashes host application when library unloaded.
git-svn-id: trunk@32931 -
This commit is contained in:
parent
6c287991f6
commit
69140ad22a
@ -77,7 +77,7 @@ type
|
||||
FAppLoop: TApplicationMainLoop;
|
||||
FAppStdEvents: Boolean;
|
||||
fMenuEnabled: Boolean;
|
||||
|
||||
FAEventHandlerRef: array[0..10] of EventHandlerRef;
|
||||
{$ifdef CarbonUseCocoa}
|
||||
pool: NSAutoreleasePool;
|
||||
{$endif}
|
||||
|
@ -1027,23 +1027,23 @@ begin
|
||||
//DebugLn('TCarbonWidgetSet.RegisterEvents');
|
||||
TmpSpec := MakeEventSpec(kEventClassCommand, kEventCommandProcess);
|
||||
InstallApplicationEventHandler(RegisterEventHandler(@CarbonApp_CommandProcess),
|
||||
1, @TmpSpec, nil, nil);
|
||||
1, @TmpSpec, nil, @FAEventHandlerRef[0]);
|
||||
|
||||
TmpSpec := MakeEventSpec(kEventClassApplication, kEventAppShown);
|
||||
InstallApplicationEventHandler(RegisterEventHandler(@CarbonApp_Shown),
|
||||
1, @TmpSpec, nil, nil);
|
||||
1, @TmpSpec, nil, @FAEventHandlerRef[1]);
|
||||
|
||||
TmpSpec := MakeEventSpec(kEventClassApplication, kEventAppHidden);
|
||||
InstallApplicationEventHandler(RegisterEventHandler(@CarbonApp_Hidden),
|
||||
1, @TmpSpec, nil, nil);
|
||||
1, @TmpSpec, nil, @FAEventHandlerRef[2]);
|
||||
|
||||
TmpSpec := MakeEventSpec(kEventClassApplication, kEventAppDeactivated);
|
||||
InstallApplicationEventHandler(RegisterEventHandler(@CarbonApp_Deactivated),
|
||||
1, @TmpSpec, nil, nil);
|
||||
1, @TmpSpec, nil, @FAEventHandlerRef[3]);
|
||||
|
||||
TmpSpec := MakeEventSpec(kEventClassApplication, kEventAppActivated);
|
||||
InstallApplicationEventHandler(RegisterEventHandler(@CarbonApp_Activated),
|
||||
1, @TmpSpec, nil, nil);
|
||||
1, @TmpSpec, nil, @FAEventHandlerRef[4]);
|
||||
|
||||
FOpenEventHandlerUPP := NewAEEventHandlerUPP(AEEventHandlerProcPtr(@CarbonApp_Open));
|
||||
FQuitEventHandlerUPP := NewAEEventHandlerUPP(AEEventHandlerProcPtr(@CarbonApp_Quit));
|
||||
@ -1065,6 +1065,9 @@ end;
|
||||
Tells Carbon to halt the application
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCarbonWidgetSet.AppTerminate;
|
||||
var i:integer;
|
||||
const
|
||||
SName = 'AppTerminate';
|
||||
begin
|
||||
if FTerminating then Exit;
|
||||
{$IFDEF VerboseObject}
|
||||
@ -1072,6 +1075,9 @@ begin
|
||||
{$ENDIF}
|
||||
FUserTerm:=True;
|
||||
QuitApplicationEventLoop;
|
||||
for i:=0 to 4 do
|
||||
OSError(MacOSALL.RemoveEventHandler(FAEventHandlerRef[i]),
|
||||
TClass(Self), SName, 'RemoveEventHandler');
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user