From 54850d4c762f1c44f2dad34b0d01b33a4d881e7f Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 19 Apr 2023 13:18:16 +0300 Subject: 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. --- src/interface-gtk/interface.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src') 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 { -- cgit v1.2.3