diff options
author | Colomban Wendling <ban@herbesfolles.org> | 2017-02-26 20:18:26 +0100 |
---|---|---|
committer | Colomban Wendling <ban@herbesfolles.org> | 2017-02-26 20:18:26 +0100 |
commit | f31063c87e800351ac6416ecdb0b3f9a1b842f7f (patch) | |
tree | 1feefe3d9c828533d18f723749a3f4c74d1239b9 | |
parent | 50f3572d8f0e2a2df0a1dc3ab721ee4bdf89b4a9 (diff) | |
download | scintilla-mirror-f31063c87e800351ac6416ecdb0b3f9a1b842f7f.tar.gz |
Bug [#1907]. GTK: 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.
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | gtk/ScintillaGTKAccessible.cxx | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 35bad2ece..ad0910e52 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -535,6 +535,10 @@ <a href="http://sourceforge.net/p/scintilla/bugs/1915/">Bug #1915</a>. </li> <li> + Fix crash in accessibility code on GTK+ < 3.3.6 caused by previous bug fix. + <a href="http://sourceforge.net/p/scintilla/bugs/1907/">Bug #1907</a>. + </li> + <li> Fix to prevent double scrolling on GTK+ with X11. <a href="http://sourceforge.net/p/scintilla/bugs/1901/">Bug #1901</a>. </li> diff --git a/gtk/ScintillaGTKAccessible.cxx b/gtk/ScintillaGTKAccessible.cxx index c1db5623e..948b19575 100644 --- a/gtk/ScintillaGTKAccessible.cxx +++ b/gtk/ScintillaGTKAccessible.cxx @@ -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) { |