aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2012-10-15 04:34:34 (EDT)
committerLakshmi Shanmugam2012-10-15 07:20:09 (EDT)
commitb83fa2d5168cae14dbf74a7de74446d33fdf7524 (patch)
treeed07f355d007c810eae3480bd89e2ef16f2c63ce
parentdf2aec5c90d07756dc802b7f295801f7f8f7b06a (diff)
downloadeclipse.platform.swt-b83fa2d5168cae14dbf74a7de74446d33fdf7524.zip
eclipse.platform.swt-b83fa2d5168cae14dbf74a7de74446d33fdf7524.tar.gz
eclipse.platform.swt-b83fa2d5168cae14dbf74a7de74446d33fdf7524.tar.bz2
Bug 380966-Tree crash calling OS.object_getInstanceVariable()
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TreeItem.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java4
6 files changed, 31 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras
index 7b1602c..640b813 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras
@@ -774,6 +774,9 @@
<method selector="copy" swt_gen="true">
<retval swt_gen="true"></retval>
</method>
+ <method selector="dealloc" swt_gen="true">
+ <retval swt_gen="true"></retval>
+ </method>
<method selector="description" swt_gen="true">
<retval swt_gen="true"></retval>
</method>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java
index fe68483..4e502c3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 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
@@ -121,6 +121,10 @@ public id copy() {
return result != 0 ? new id(result) : null;
}
+public void dealloc () {
+ OS.objc_msgSend (this.id, OS.sel_dealloc);
+}
+
public NSString description() {
long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_description);
return result != 0 ? new NSString(result) : null;
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 7706c17..038bab6 100644
--- 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
@@ -2849,6 +2849,7 @@ void initClasses () {
className = "SWTTreeItem";
cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types);
+ OS.class_addMethod(cls, OS.sel_dealloc, proc2, "@:");
OS.objc_registerClassPair(cls);
className = "SWTView";
@@ -5358,6 +5359,8 @@ static long /*int*/ windowProc(long /*int*/ id, long /*int*/ sel) {
if (widget == null) return 0;
if (sel == OS.sel_sendSelection) {
widget.sendSelection();
+ } else if (sel == OS.sel_dealloc) {
+ widget.dealloc(id, sel);
} else if (sel == OS.sel_sendDoubleSelection) {
widget.sendDoubleSelection();
} else if (sel == OS.sel_sendVerticalSelection) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
index 871d7c2..591e3ca 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
@@ -2330,11 +2330,6 @@ void register () {
}
void releaseChildren (boolean destroy) {
- itemCount = 0;
- ignoreSelect = true;
- ((NSOutlineView) view).reloadData ();
- ignoreSelect = false;
-
for (int i=0; i<items.length; i++) {
TreeItem item = items [i];
if (item != null && !item.isDisposed ()) {
@@ -2383,10 +2378,6 @@ void releaseWidget () {
*/
public void removeAll () {
checkWidget ();
- itemCount = 0;
- ignoreSelect = true;
- ((NSOutlineView) view).reloadData ();
- ignoreSelect = false;
for (int i=0; i<items.length; i++) {
TreeItem item = items [i];
if (item != null && !item.isDisposed ()) item.release (false);
@@ -2395,6 +2386,9 @@ public void removeAll () {
itemCount = 0;
imageBounds = null;
insertItem = null;
+ ignoreSelect = true;
+ ((NSOutlineView) view).reloadData ();
+ ignoreSelect = false;
setScrollWidth ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TreeItem.java
index 95d25a4..6421bcc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TreeItem.java
@@ -371,9 +371,20 @@ NSObject createString(int index) {
return NSString.stringWith(text != null ? text : "");
}
+void dealloc (int /*long*/ id, int /*long*/ sel) {
+ super.dealloc(id, sel);
+ OS.object_setInstanceVariable(id, Display.SWT_OBJECT, 0);
+ super.destroyJNIRef();
+}
+
void deregister () {
super.deregister ();
- display.removeWidget (handle);
+ //This is done in #dealloc
+// display.removeWidget (handle);
+}
+
+void destroyJNIRef () {
+ //Do nothing - see #dealloc
}
void destroyWidget () {
@@ -986,7 +997,7 @@ void releaseChildren (boolean destroy) {
void releaseHandle () {
super.releaseHandle ();
- if (handle != null) handle.release ();
+ if (handle != null) handle.autorelease ();
handle = null;
parentItem = null;
parent = null;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
index 5a24c9a..c5513fb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
@@ -621,6 +621,10 @@ void comboBoxWillDismiss(long /*int*/ id, long /*int*/ sel, long /*int*/ notific
void comboBoxWillPopUp(long /*int*/ id, long /*int*/ sel, long /*int*/ notification) {
}
+void dealloc (long /*int*/id, long /*int*/sel) {
+ callSuper (id, sel);
+}
+
void deregister () {
}