comparison src/macosx/native/sun/awt/CMenu.m @ 7871:d502cc7bcc3d

8006634: Unify LWCToolkit.invokeAndWait() and sun.awt.datatransfer.ToolkitThreadBlockedHandler Summary: Changed the logic for the nested event loops and deleted deadlock detection Reviewed-by: art, denis
author pchelko
date Mon, 25 Feb 2013 10:17:25 +0000
parents 5309fed435b5
children
comparison
equal deleted inserted replaced
1:750e95bc7aef 2:46d60ff32644
53 [super dealloc]; 53 [super dealloc];
54 } 54 }
55 //- (void)finalize { [super finalize]; } 55 //- (void)finalize { [super finalize]; }
56 56
57 - (void)addJavaSubmenu:(CMenu *)submenu { 57 - (void)addJavaSubmenu:(CMenu *)submenu {
58 [ThreadUtilities performOnMainThread:@selector(addNativeItem_OnAppKitThread:) onObject:self withObject:submenu waitUntilDone:YES awtMode:YES]; 58 [ThreadUtilities performOnMainThread:@selector(addNativeItem_OnAppKitThread:) on:self withObject:submenu waitUntilDone:YES];
59 } 59 }
60 60
61 - (void)addJavaMenuItem:(CMenuItem *)theMenuItem { 61 - (void)addJavaMenuItem:(CMenuItem *)theMenuItem {
62 [ThreadUtilities performOnMainThread:@selector(addNativeItem_OnAppKitThread:) onObject:self withObject:theMenuItem waitUntilDone:YES awtMode:YES]; 62 [ThreadUtilities performOnMainThread:@selector(addNativeItem_OnAppKitThread:) on:self withObject:theMenuItem waitUntilDone:YES];
63 } 63 }
64 64
65 - (void)addNativeItem_OnAppKitThread:(CMenuItem *)itemModified { 65 - (void)addNativeItem_OnAppKitThread:(CMenuItem *)itemModified {
66 AWT_ASSERT_APPKIT_THREAD; 66 AWT_ASSERT_APPKIT_THREAD;
67 [itemModified addNSMenuItemToMenu:[self menu]]; 67 [itemModified addNSMenuItemToMenu:[self menu]];
68 } 68 }
69 69
70 - (void)setJavaMenuTitle:(NSString *)title { 70 - (void)setJavaMenuTitle:(NSString *)title {
71 71
72 if (title) { 72 if (title) {
73 [ThreadUtilities performOnMainThread:@selector(setNativeMenuTitle_OnAppKitThread:) onObject:self withObject:title waitUntilDone:YES awtMode:YES]; 73 [ThreadUtilities performOnMainThread:@selector(setNativeMenuTitle_OnAppKitThread:) on:self withObject:title waitUntilDone:YES];
74 } 74 }
75 } 75 }
76 76
77 - (void)setNativeMenuTitle_OnAppKitThread:(NSString *)title { 77 - (void)setNativeMenuTitle_OnAppKitThread:(NSString *)title {
78 AWT_ASSERT_APPKIT_THREAD; 78 AWT_ASSERT_APPKIT_THREAD;
91 // Nothing calls this, which is good because we need a CMenuItem here. 91 // Nothing calls this, which is good because we need a CMenuItem here.
92 } 92 }
93 93
94 - (void)deleteJavaItem:(jint)index { 94 - (void)deleteJavaItem:(jint)index {
95 95
96 [ThreadUtilities performOnMainThread:@selector(deleteNativeJavaItem_OnAppKitThread:) onObject:self withObject:[NSNumber numberWithInt:index] waitUntilDone:YES awtMode:YES]; 96 [ThreadUtilities performOnMainThread:@selector(deleteNativeJavaItem_OnAppKitThread:) on:self withObject:[NSNumber numberWithInt:index] waitUntilDone:YES];
97 } 97 }
98 98
99 - (void)deleteNativeJavaItem_OnAppKitThread:(NSNumber *)number { 99 - (void)deleteNativeJavaItem_OnAppKitThread:(NSNumber *)number {
100 AWT_ASSERT_APPKIT_THREAD; 100 AWT_ASSERT_APPKIT_THREAD;
101 101
137 CMenu *aCMenu = nil; 137 CMenu *aCMenu = nil;
138 138
139 // We use an array here only to be able to get a return value 139 // We use an array here only to be able to get a return value
140 NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithBytes:&cPeerObjGlobal objCType:@encode(jobject)], nil]; 140 NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithBytes:&cPeerObjGlobal objCType:@encode(jobject)], nil];
141 141
142 [ThreadUtilities performOnMainThread:@selector(_create_OnAppKitThread:) onObject:[CMenu alloc] withObject:args waitUntilDone:YES awtMode:YES]; 142 [ThreadUtilities performOnMainThread:@selector(_create_OnAppKitThread:) on:[CMenu alloc] withObject:args waitUntilDone:YES];
143 143
144 aCMenu = (CMenu *)[args objectAtIndex: 0]; 144 aCMenu = (CMenu *)[args objectAtIndex: 0];
145 145
146 if (aCMenu == nil) { 146 if (aCMenu == nil) {
147 return 0L; 147 return 0L;