diff options
author | Carolyn MacLeod <carolyn> | 2005-07-26 21:50:50 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2005-07-26 21:50:50 +0000 |
commit | a43e9348c53e991d1e17f5fc5c825cfc527e58ec (patch) | |
tree | ad1501608a3b6aba174cfe8a0501f5637708fcd6 /bundles/org.eclipse.swt | |
parent | 04b932771623d7eb93923b866e61e22527dfb6d5 (diff) | |
download | eclipse.platform.swt-a43e9348c53e991d1e17f5fc5c825cfc527e58ec.tar.gz eclipse.platform.swt-a43e9348c53e991d1e17f5fc5c825cfc527e58ec.tar.xz eclipse.platform.swt-a43e9348c53e991d1e17f5fc5c825cfc527e58ec.zip |
Fix for 45708. Made sure that releaseWidget methods are all reentrant.
Diffstat (limited to 'bundles/org.eclipse.swt')
9 files changed, 40 insertions, 26 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java index 17cd3612a7..1009cfb0d7 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java @@ -644,10 +644,12 @@ void resizeToMaximumWidth (int index) { } void releaseWidget () { - for (int i=0; i<items.length; i++) { - CoolItem item = items [i]; - if (item != null && !item.isDisposed ()) { - item.releaseResources (); + if (items != null) { + for (int i=0; i<items.length; i++) { + CoolItem item = items [i]; + if (item != null && !item.isDisposed ()) { + item.releaseResources (); + } } } items = null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java index 112e328ff9..5b303d7e26 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java @@ -1064,7 +1064,7 @@ void releaseWidget () { MenuItem [] items = getItems (); for (int i=0; i<items.length; i++) { MenuItem item = items [i]; - if (!item.isDisposed ()) { + if (item != null && !item.isDisposed ()) { if (OS.IsPPC && hwndCB != 0) { item.dispose (); } else { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java index 002069c102..22b17f7206 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java @@ -494,7 +494,7 @@ void releaseWidget () { if (menu != null) menu.releaseResources (); menu = null; super.releaseWidget (); - if (accelerator != 0) { + if (accelerator != 0 && parent != null) { parent.destroyAccelerators (); } accelerator = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java index 60340bc9e5..06d530c583 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java @@ -522,9 +522,13 @@ boolean mnemonicMatch (char key) { void releaseWidget () { int count = OS.SendMessage (handle, OS.TCM_GETITEMCOUNT, 0, 0); - for (int i=0; i<count; i++) { - TabItem item = items [i]; - if (!item.isDisposed ()) item.releaseResources (); + if (items != null) { + for (int i=0; i<count; i++) { + TabItem item = items [i]; + if (item != null && !item.isDisposed ()) { + item.releaseResources (); + } + } } items = null; if (imageList != null) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java index 4cab59c8ef..0f6d750286 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java @@ -1799,9 +1799,9 @@ public boolean isSelected (int index) { void releaseWidget () { int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); - int columnCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); + int columnCount = columns == null ? 0 : OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); if (columnCount == 1 && columns [0] == null) columnCount = 0; - int itemCount = OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0); + int itemCount = items == null ? 0 : OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0); /* * Feature in Windows 98. When there are a large number * of columns and items in a table (>1000) where each @@ -1837,7 +1837,9 @@ void releaseWidget () { items = null; for (int i=0; i<columnCount; i++) { TableColumn column = columns [i]; - if (!column.isDisposed ()) column.releaseResources (); + if (column != null && !column.isDisposed ()) { + column.releaseResources (); + } } columns = null; if (imageList != null) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java index e9891e6bd1..3a813fced4 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java @@ -407,7 +407,7 @@ void releaseChild () { void releaseWidget () { super.releaseWidget (); - if (parent.sortColumn == this) { + if (parent != null && parent.sortColumn == this) { parent.sortColumn = null; } parent = null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java index 98ea65c10c..063375b0a8 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java @@ -626,11 +626,13 @@ boolean mnemonicMatch (char ch) { } void releaseWidget () { - for (int i=0; i<items.length; i++) { - ToolItem item = items [i]; - if (item != null && !item.isDisposed ()) { - item.releaseImages (); - item.releaseResources (); + if (items != null) { + for (int i=0; i<items.length; i++) { + ToolItem item = items [i]; + if (item != null && !item.isDisposed ()) { + item.releaseImages (); + item.releaseResources (); + } } } items = null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java index e93b8780ed..a44e4d5ad2 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java @@ -1762,16 +1762,20 @@ void releaseHandle () { void releaseWidget () { int columnCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); - for (int i=0; i<items.length; i++) { - TreeItem item = items [i]; - if (item != null && !item.isDisposed ()) { - item.releaseResources (); + if (items != null) { + for (int i=0; i<items.length; i++) { + TreeItem item = items [i]; + if (item != null && !item.isDisposed ()) { + item.releaseResources (); + } } } items = null; - for (int i=0; i<columnCount; i++) { - TreeColumn column = columns [i]; - if (!column.isDisposed ()) column.releaseResources (); + if (columns != null) { + for (int i=0; i<columnCount; i++) { + TreeColumn column = columns [i]; + if (!column.isDisposed ()) column.releaseResources (); + } } columns = null; /* diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java index 02ec1c5a85..78be40b8f3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java @@ -375,7 +375,7 @@ void releaseChild () { void releaseWidget () { super.releaseWidget (); - if (parent.sortColumn == this) { + if (parent != null && parent.sortColumn == this) { parent.sortColumn = null; } parent = null; |