Skip to content

Commit 3bcbb47

Browse files
committed
[Gtk] Make Tree/Table cellDataProc safe for disposed items
Table/Tree.remove method ends up firing Gtk signal(s) that cause cellDataProc to start. Make cellDataProc explicitly check whether item is disposed to prevent operating on disposed item. Fixes #1606
1 parent cde95ee commit 3bcbb47

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ long cellDataProc (long tree_column, long cell, long tree_model, long iter, long
199199
int [] index = new int [1];
200200
C.memmove (index, GTK.gtk_tree_path_get_indices (path), 4);
201201
TableItem item = _getItem (index[0]);
202+
if (item.isDisposed()) {
203+
return 0;
204+
}
202205
GTK.gtk_tree_path_free (path);
203206
if (item != null) OS.g_object_set_qdata (cell, Display.SWT_OBJECT_INDEX2, item.handle);
204207
boolean isPixbuf = GTK.GTK_IS_CELL_RENDERER_PIXBUF (cell);

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ static int checkStyle (int style) {
276276
long cellDataProc (long tree_column, long cell, long tree_model, long iter, long data) {
277277
if (cell == ignoreCell) return 0;
278278
TreeItem item = _getItem (iter);
279+
if (item.isDisposed()) {
280+
return 0;
281+
}
279282
if (item != null) OS.g_object_set_qdata (cell, Display.SWT_OBJECT_INDEX2, item.handle);
280283
boolean isPixbuf = GTK.GTK_IS_CELL_RENDERER_PIXBUF (cell);
281284
boolean isText = GTK.GTK_IS_CELL_RENDERER_TEXT (cell);

0 commit comments

Comments
 (0)