Skip to content

Commit

Permalink
[GTK3] Do not crash in SetData event
Browse files Browse the repository at this point in the history
GTK 3.24.41 (Ubuntu 24) crashes when renderers are replaced during
render.
If replacement is postponed, the crash no longer happens.

Fixes #678.
  • Loading branch information
basilevs committed Nov 22, 2024
1 parent e6588c2 commit 7e7c87c
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,17 @@ public void setImage(int index, Image image) {
* supposed to be rendered in. See bug 513761.
*/
boolean check = modelIndex == Tree.FIRST_COLUMN && (parent.style & SWT.CHECK) != 0;
parent.createRenderers(column, modelIndex, check, parent.style);
// Renderers can't be replaced during render on GTK 3.24.41
// https://github.com/eclipse-platform/eclipse.platform.swt/issues/678
getDisplay().asyncExec(() -> {
// Do not perform request if it is no longer applicable
if (parent.isDisposed() || Math.max (1, parent.getColumnCount ()) <= index) return;
// On multiple resize requests, perform only the last one
if (parent.pixbufHeight != iHeight || parent.pixbufWidth != iWidth) return;
int modelIndexAsync = parent.columnCount == 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex;
long columnAsync = GTK.gtk_tree_view_get_column (parent.handle, index);
parent.createRenderers(columnAsync, modelIndexAsync, check, parent.style);
});
}
}
}
Expand Down

0 comments on commit 7e7c87c

Please sign in to comment.