Repository navigation
Commit 3f24428
committed
Stop touching menu widgets that GTK already destroyed
A GtkMenu owns its items, so ~Menu() destroying the menu widget took every item
widget with it; the MenuItem destructors then disconnected signal handlers on
freed memory, which GLib reported as "invalid unclassed pointer in cast to
'GObject'" — eleven criticals when the window example shut down.
Hold the widget pointers through g_object_add_weak_pointer() so GTK clears them
on destruction and the existing null checks skip the cleanup. This works
whichever side goes first, unlike fixing the destruction order.1 parent d9ba959 commit 3f24428
1 file changed
Lines changed: 28 additions & 3 deletions
File tree
- src/platform/linux
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
94 | 106 | | |
95 | 107 | | |
96 | 108 | | |
| |||
227 | 239 | | |
228 | 240 | | |
229 | 241 | | |
230 | | - | |
| 242 | + | |
| 243 | + | |
231 | 244 | | |
232 | 245 | | |
233 | 246 | | |
| |||
464 | 477 | | |
465 | 478 | | |
466 | 479 | | |
467 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
468 | 493 | | |
469 | 494 | | |
470 | 495 | | |
| |||
0 commit comments