< prev index next >
src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m
Print this page
rev 57287 : 8234522: [macos] Crash with use of native file dialog
Reviewed-by: XXX
*** 1,7 ****
/*
! * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 48,58 ****
/**
* Subtypes of NSApplicationDefined, which are used for custom events.
*/
enum {
! ExecuteBlockEvent, NativeSyncQueueEvent
};
@implementation NSApplicationAWT
- (id) init
--- 48,58 ----
/**
* Subtypes of NSApplicationDefined, which are used for custom events.
*/
enum {
! ExecuteBlockEvent = 777, NativeSyncQueueEvent
};
@implementation NSApplicationAWT
- (id) init
*** 364,378 ****
- (void)sendEvent:(NSEvent *)event
{
if ([event type] == NSApplicationDefined
&& TS_EQUAL([event timestamp], dummyEventTimestamp)
! && [event subtype] == NativeSyncQueueEvent) {
[seenDummyEventLock lockWhenCondition:NO];
[seenDummyEventLock unlockWithCondition:YES];
!
! } else if ([event type] == NSApplicationDefined && [event subtype] == ExecuteBlockEvent) {
void (^block)() = (void (^)()) [event data1];
block();
[block release];
} else if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) {
// Cocoa won't send us key up event when releasing a key while Cmd is down,
--- 364,381 ----
- (void)sendEvent:(NSEvent *)event
{
if ([event type] == NSApplicationDefined
&& TS_EQUAL([event timestamp], dummyEventTimestamp)
! && (short)[event subtype] == NativeSyncQueueEvent
! && [event data1] == NativeSyncQueueEvent
! && [event data2] == NativeSyncQueueEvent) {
[seenDummyEventLock lockWhenCondition:NO];
[seenDummyEventLock unlockWithCondition:YES];
! } else if ([event type] == NSApplicationDefined
! && (short)[event subtype] == ExecuteBlockEvent
! && [event data1] != 0 && [event data2] == ExecuteBlockEvent) {
void (^block)() = (void (^)()) [event data1];
block();
[block release];
} else if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) {
// Cocoa won't send us key up event when releasing a key while Cmd is down,
*** 399,409 ****
timestamp: 0
windowNumber: 0
context: nil
subtype: ExecuteBlockEvent
data1: encode
! data2: 0];
[NSApp postEvent: event atStart: NO];
[pool drain];
}
--- 402,412 ----
timestamp: 0
windowNumber: 0
context: nil
subtype: ExecuteBlockEvent
data1: encode
! data2: ExecuteBlockEvent];
[NSApp postEvent: event atStart: NO];
[pool drain];
}
*** 417,428 ****
modifierFlags: 0
timestamp: dummyEventTimestamp
windowNumber: 0
context: nil
subtype: NativeSyncQueueEvent
! data1: 0
! data2: 0];
if (useCocoa) {
[NSApp postEvent:event atStart:NO];
} else {
ProcessSerialNumber psn;
GetCurrentProcess(&psn);
--- 420,431 ----
modifierFlags: 0
timestamp: dummyEventTimestamp
windowNumber: 0
context: nil
subtype: NativeSyncQueueEvent
! data1: NativeSyncQueueEvent
! data2: NativeSyncQueueEvent];
if (useCocoa) {
[NSApp postEvent:event atStart:NO];
} else {
ProcessSerialNumber psn;
GetCurrentProcess(&psn);
< prev index next >