[geany/geany] 1421a3: scintilla: Fix crash after destroying the widget on GTK < 3.3.6

Colomban Wendling git-noreply at xxxxx
Sun Feb 26 19:07:33 UTC 2017


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sun, 26 Feb 2017 19:07:33 UTC
Commit:      1421a3f9c59a41074636a26cca6b431c3af40226
             https://github.com/geany/geany/commit/1421a3f9c59a41074636a26cca6b431c3af40226

Log Message:
-----------
scintilla: Fix crash after destroying the widget on GTK < 3.3.6

On GTK2 and GTK3 < 3.3.6 there is no GtkAccessibleClass::widget_unset()
method, so we can't destroy our accessible object right away.  So, to
avoid accessing a destroyed widget, we need to check whether the widget
still exists in the the ScintillaGTKAccessible destructor.

In other methods it's not necessary because the wrapping GObject class
makes sure not to forward other when the widget has been destroyed, but
we still have to destroy the C++ instance no matter what, so the check
has to be on this side.

Fixes #1410.


Modified Paths:
--------------
    scintilla/gtk/ScintillaGTKAccessible.cxx

Modified: scintilla/gtk/ScintillaGTKAccessible.cxx
4 lines changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -162,7 +162,9 @@ ScintillaGTKAccessible::ScintillaGTKAccessible(GtkAccessible *accessible_, GtkWi
 }
 
 ScintillaGTKAccessible::~ScintillaGTKAccessible() {
-	g_signal_handlers_disconnect_matched(sci->sci, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, this);
+	if (gtk_accessible_get_widget(accessible)) {
+		g_signal_handlers_disconnect_matched(sci->sci, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, this);
+	}
 }
 
 gchar *ScintillaGTKAccessible::GetTextRangeUTF8(Position startByte, Position endByte) {



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list