Commit 81a811a
committed
[Gtk3] Fix crash in TreeItem.setImage
Calling createRenderers() (which invokes
gtk_tree_view_column_clear()) is unsafe when setImage() call originates
from a SWT.SetData listener, because GTK is currently iterating the
column's cell renderer list inside
gtk_tree_view_column_cell_set_cell_data().
This frees that list while GTK still holds a pointer into it, causing a
use-after-free SIGSEGV on GTK3
(#678 ).
Instead, toggle the fixed-height-mode GObject property off and back on.
This resets GTK's cached row height (fixed_height = -1) and schedules an
async widget resize, so GTK will re-measure on the next layout pass and
pick up the updated renderer size. Unlike gtk_tree_view_column_clear(),
this does not modify the renderer list and is therefore safe to call
from within a cell_data_func callback.
Tested that Debug and variable views don't have icons without the
fixed_height_mode off/on setting and icons are fine with it.1 parent 88efa82 commit 81a811a
1 file changed
Lines changed: 12 additions & 10 deletions
Lines changed: 12 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
1516 | 1516 | | |
1517 | 1517 | | |
1518 | 1518 | | |
1519 | | - | |
1520 | | - | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1521 | 1522 | | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
1522 | 1529 | | |
1523 | 1530 | | |
1524 | | - | |
1525 | | - | |
1526 | | - | |
1527 | | - | |
1528 | | - | |
1529 | | - | |
1530 | | - | |
| 1531 | + | |
| 1532 | + | |
1531 | 1533 | | |
1532 | 1534 | | |
1533 | 1535 | | |
| |||
0 commit comments