From 9a80949a18eff49434f46c96af608ae42a363d3e Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Fri, 10 May 2013 14:58:45 -0400 Subject: Bug 407555 - StackOverflowError in SWT widgets on Mac OS --- .../org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras | 4 ++++ .../cocoa/org/eclipse/swt/internal/cocoa/NSView.java | 6 +++++- .../Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java | 1 + .../Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java | 7 ++++++- 4 files changed, 16 insertions(+), 2 deletions(-) (limited to 'bundles') diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras index 7500c9fb46..4452ba50d6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras @@ -3979,6 +3979,10 @@ + + + + diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java index 7dd64ab18e..853ff943f6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -178,6 +178,10 @@ public NSView initWithFrame(NSRect frameRect) { return result == this.id ? this : (result != 0 ? new NSView(result) : null); } +public boolean isDescendantOf(NSView aView) { + return OS.objc_msgSend_bool(this.id, OS.sel_isDescendantOf_, aView != null ? aView.id : 0); +} + public boolean isFlipped() { return OS.objc_msgSend_bool(this.id, OS.sel_isFlipped); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index dc3560ee25..83e395e83e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -1438,6 +1438,7 @@ public static final long /*int*/ sel_invalidate = sel_registerName("invalidate") public static final long /*int*/ sel_invalidateShadow = sel_registerName("invalidateShadow"); public static final long /*int*/ sel_invert = sel_registerName("invert"); public static final long /*int*/ sel_isActive = sel_registerName("isActive"); +public static final long /*int*/ sel_isDescendantOf_ = sel_registerName("isDescendantOf:"); public static final long /*int*/ sel_isDocumentEdited = sel_registerName("isDocumentEdited"); public static final long /*int*/ sel_isDrawingToScreen = sel_registerName("isDrawingToScreen"); public static final long /*int*/ sel_isEmpty = sel_registerName("isEmpty"); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java index 946473f8df..d27ffa40f2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java @@ -4915,7 +4915,12 @@ public void update () { void update (boolean all) { // checkWidget(); - if (display.isPainting.containsObject(view)) return; + NSArray isPainting = display.isPainting; + if (isPainting.containsObject(view)) return; + for (int i = 0, length = (int)/*64*/isPainting.count(); i < length; i++) { + NSView view = new NSView(isPainting.objectAtIndex(i)); + if (view.isDescendantOf(this.view)) return; + } if (isResizing()) return; Shell shell = getShell(); NSWindow window = shell.deferFlushing && shell.scrolling ? view.window() : null; -- cgit