diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2023-04-19 13:18:16 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2023-04-19 13:18:16 +0300 |
commit | 54850d4c762f1c44f2dad34b0d01b33a4d881e7f (patch) | |
tree | d6b30422bf5aa049a5517422d1c8af627fa36f6a /src | |
parent | 52753962e231c3eca102eab02adc5ed9cab0472b (diff) | |
download | sciteco-54850d4c762f1c44f2dad34b0d01b33a4d881e7f.tar.gz |
fixup: reverted the last Scintilla patch and unref Scintilla objects via g_object_unref()
* Turns out that using gtk_widget_destroy(), the finalize handler never gets called!?
This means we were leaking memory.
* Using g_object_unref() fixes that and the initial Scintilla patch is no longer necessary.
* There have previously been use-after-free bugs when *not* using gtk_widget_destroy().
This has apparently been fixed in the meantime in Scintilla.
Diffstat (limited to 'src')
-rw-r--r-- | src/interface-gtk/interface.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 3dcabf5..32f0011 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -154,15 +154,7 @@ teco_view_ssm(teco_view_t *ctx, unsigned int iMessage, uptr_t wParam, sptr_t lPa void teco_view_free(teco_view_t *ctx) { - /* - * FIXME: It's not entirely clear why g_object_unref() won't do here. - * This results in crashes later on because something is still referencing - * the widget/GObject. - * However, currently displayed views (ctx == teco_interface.current_view_widget) - * should have a reference count of 2 and unreffing them should not actually - * touch the object until is is removed from the view. - */ - gtk_widget_destroy(teco_view_get_widget(ctx)); + g_object_unref(teco_view_get_widget(ctx)); } static struct { |