diff options
author | Kevin Barnes <krbarnes> | 2009-03-26 21:42:04 +0000 |
---|---|---|
committer | Kevin Barnes <krbarnes> | 2009-03-26 21:42:04 +0000 |
commit | 849737990e1e8297b762c3b6d5d7471e3b1737be (patch) | |
tree | 80e58bfba7c34d16641be835e651c56f0162e874 /bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets | |
parent | ee2f579d39aac1495e26936c185f2d3fdde43458 (diff) | |
download | eclipse.platform.swt-849737990e1e8297b762c3b6d5d7471e3b1737be.tar.gz eclipse.platform.swt-849737990e1e8297b762c3b6d5d7471e3b1737be.tar.xz eclipse.platform.swt-849737990e1e8297b762c3b6d5d7471e3b1737be.zip |
270036 - UI Test Suite does not run to completion.
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets')
3 files changed, 75 insertions, 51 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java index c00ad704ad..9fa4f423e9 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java @@ -2866,6 +2866,7 @@ public boolean readAndDispatch () { pool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init(); } loopCounter ++; + NSAutoreleasePool localPool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init(); try { boolean events = false; events |= runTimers (); @@ -2880,11 +2881,11 @@ public boolean readAndDispatch () { if (events || runDeferredEvents ()) { return true; } - return runAsyncMessages (false); } finally { + localPool.release(); loopCounter --; } - + return runAsyncMessages (false); } static void register (Display display) { @@ -3168,7 +3169,12 @@ void removePopup (Menu menu) { } boolean runAsyncMessages (boolean all) { - return synchronizer.runAsyncMessages (all); + NSAutoreleasePool localPool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); + try { + return synchronizer.runAsyncMessages (all); + } finally { + localPool.release(); + } } boolean runContexts () { @@ -3625,9 +3631,14 @@ public boolean sleep () { pool.release(); pool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init(); } - allowTimers = runAsyncMessages = false; - NSRunLoop.currentRunLoop().runMode(OS.NSDefaultRunLoopMode, NSDate.distantFuture()); - allowTimers = runAsyncMessages = true; + NSAutoreleasePool localPool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init(); + try { + allowTimers = runAsyncMessages = false; + NSRunLoop.currentRunLoop().runMode(OS.NSDefaultRunLoopMode, NSDate.distantFuture()); + allowTimers = runAsyncMessages = true; + } finally { + localPool.release(); + } return true; } @@ -3663,7 +3674,12 @@ public void syncExec (Runnable runnable) { if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); synchronizer = this.synchronizer; } - synchronizer.syncExec (runnable); + NSAutoreleasePool localPool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); + try { + synchronizer.syncExec (runnable); + } finally { + localPool.release(); + } } /** @@ -3835,6 +3851,7 @@ public void wake () { } void wakeThread () { + //new pool? NSObject object = new NSObject().alloc().init(); object.performSelectorOnMainThread(OS.sel_release, null, false); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java index 7b156f3121..bf4b23bf08 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java @@ -1518,6 +1518,10 @@ void setWindowVisible (boolean visible, boolean key) { } if (window != null && (window.isVisible() == visible)) return; if (visible) { + if (display.loopCounter == 0) { + display.pool.release(); + display.pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); + } sendEvent (SWT.Show); if (isDisposed ()) return; topView ().setHidden (false); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tracker.java index e5e9a96862..4ca6690d29 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tracker.java @@ -792,51 +792,54 @@ public boolean open () { /* Tracker behaves like a Dialog with its own OS event loop. */ while (tracking && !cancelled) { NSAutoreleasePool pool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init(); - NSEvent event = application.nextEventMatchingMask(0, NSDate.distantFuture(), OS.NSDefaultRunLoopMode, true); - if (event == null) continue; - int type = (int)/*64*/event.type(); - switch (type) { - case OS.NSLeftMouseUp: - case OS.NSRightMouseUp: - case OS.NSOtherMouseUp: - case OS.NSMouseMoved: - case OS.NSLeftMouseDragged: - case OS.NSRightMouseDragged: - case OS.NSOtherMouseDragged: - mouse(event); - break; - case OS.NSKeyDown: -// case OS.NSKeyUp: - case OS.NSFlagsChanged: - key(event); - break; - } - boolean dispatch = true; - switch (type) { - case OS.NSLeftMouseDown: - case OS.NSLeftMouseUp: - case OS.NSRightMouseDown: - case OS.NSRightMouseUp: - case OS.NSOtherMouseDown: - case OS.NSOtherMouseUp: - case OS.NSMouseMoved: - case OS.NSLeftMouseDragged: - case OS.NSRightMouseDragged: - case OS.NSOtherMouseDragged: - case OS.NSMouseEntered: - case OS.NSMouseExited: - case OS.NSKeyDown: - case OS.NSKeyUp: - case OS.NSFlagsChanged: - dispatch = false; - } - if (dispatch) application.sendEvent(event); - if (clientCursor != null && resizeCursor == null) { - display.lockCursor = false; - clientCursor.handle.set(); - display.lockCursor = true; + try { + NSEvent event = application.nextEventMatchingMask(0, NSDate.distantFuture(), OS.NSDefaultRunLoopMode, true); + if (event == null) continue; + int type = (int)/*64*/event.type(); + switch (type) { + case OS.NSLeftMouseUp: + case OS.NSRightMouseUp: + case OS.NSOtherMouseUp: + case OS.NSMouseMoved: + case OS.NSLeftMouseDragged: + case OS.NSRightMouseDragged: + case OS.NSOtherMouseDragged: + mouse(event); + break; + case OS.NSKeyDown: +// case OS.NSKeyUp: + case OS.NSFlagsChanged: + key(event); + break; + } + boolean dispatch = true; + switch (type) { + case OS.NSLeftMouseDown: + case OS.NSLeftMouseUp: + case OS.NSRightMouseDown: + case OS.NSRightMouseUp: + case OS.NSOtherMouseDown: + case OS.NSOtherMouseUp: + case OS.NSMouseMoved: + case OS.NSLeftMouseDragged: + case OS.NSRightMouseDragged: + case OS.NSOtherMouseDragged: + case OS.NSMouseEntered: + case OS.NSMouseExited: + case OS.NSKeyDown: + case OS.NSKeyUp: + case OS.NSFlagsChanged: + dispatch = false; + } + if (dispatch) application.sendEvent(event); + if (clientCursor != null && resizeCursor == null) { + display.lockCursor = false; + clientCursor.handle.set(); + display.lockCursor = true; + } + } finally { + pool.release(); } - pool.release(); } if (oldTrackingControl != null && !oldTrackingControl.isDisposed()) { display.trackingControl = oldTrackingControl; |