fix AppleEvent leak
svn: r13251
This commit is contained in:
parent
265f75379a
commit
57d7cd140f
|
@ -285,6 +285,9 @@ static int waiting_for_next_event;
|
||||||
static int wne_handlersInstalled;
|
static int wne_handlersInstalled;
|
||||||
static int pending_self_ae;
|
static int pending_self_ae;
|
||||||
|
|
||||||
|
static int ae_target_ready = 0;
|
||||||
|
static AEAddressDesc ae_target;
|
||||||
|
|
||||||
static void EnsureWNEReturn()
|
static void EnsureWNEReturn()
|
||||||
{
|
{
|
||||||
/* Generate an event that WaitNextEvent() will return, but that we can
|
/* Generate an event that WaitNextEvent() will return, but that we can
|
||||||
|
@ -298,15 +301,18 @@ static void EnsureWNEReturn()
|
||||||
dummy AppleEvent and defeat the purpose. */
|
dummy AppleEvent and defeat the purpose. */
|
||||||
if (!pending_self_ae) {
|
if (!pending_self_ae) {
|
||||||
ProcessSerialNumber psn;
|
ProcessSerialNumber psn;
|
||||||
AEAddressDesc target;
|
|
||||||
AppleEvent ae;
|
AppleEvent ae;
|
||||||
|
|
||||||
pending_self_ae = 1;
|
pending_self_ae = 1;
|
||||||
|
|
||||||
GetCurrentProcess(&psn);
|
GetCurrentProcess(&psn);
|
||||||
AECreateDesc(typeProcessSerialNumber, &psn, sizeof(psn), &target);
|
if (!ae_target_ready) {
|
||||||
AECreateAppleEvent('MrEd', 'Smug', &target, kAutoGenerateReturnID, kAnyTransactionID, &ae);
|
AECreateDesc(typeProcessSerialNumber, &psn, sizeof(psn), &ae_target);
|
||||||
|
ae_target_ready = 1;
|
||||||
|
AECreateAppleEvent('MrEd', 'Smug', &ae_target, kAutoGenerateReturnID, kAnyTransactionID, &ae);
|
||||||
|
}
|
||||||
AESend(&ae, NULL, kAENoReply, kAENormalPriority, kNoTimeOut, NULL, NULL);
|
AESend(&ae, NULL, kAENoReply, kAENormalPriority, kNoTimeOut, NULL, NULL);
|
||||||
|
AEDisposeDesc(&ae);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user