[gnome-builder/gnome-builder-3-28] spellcheck: protect against unbinding with a NULL spell widget



commit 2660268fd74d5ce03f4fe0093a5f20c56e29c2e8
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Wed May 30 12:44:30 2018 +0200

    spellcheck: protect against unbinding with a NULL spell widget
    
    To reproduce, spell check a word with the contextual menu
    'spellchecking' action twice (closing the widget each time)

 src/plugins/spellcheck/gbp-spell-widget.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/spellcheck/gbp-spell-widget.c b/src/plugins/spellcheck/gbp-spell-widget.c
index 0d1f7ca95..e41a0bc2e 100644
--- a/src/plugins/spellcheck/gbp-spell-widget.c
+++ b/src/plugins/spellcheck/gbp-spell-widget.c
@@ -942,16 +942,18 @@ gbp_spell_widget_unbind_addin (GbpSpellWidget *self,
 {
   g_assert (GBP_IS_SPELL_WIDGET (self));
   g_assert (DZL_IS_SIGNAL_GROUP (editor_view_addin_signals));
-  g_assert (self->editor_view_addin != NULL);
 
-  gbp_spell_editor_view_addin_end_checking (self->editor_view_addin);
-  gbp_spell_dict_set_checker (self->dict, NULL);
-  self->language = NULL;
-  gspell_language_chooser_set_language (GSPELL_LANGUAGE_CHOOSER (self->language_chooser_button), NULL);
+  if (self->editor_view_addin != NULL)
+    {
+      gbp_spell_editor_view_addin_end_checking (self->editor_view_addin);
+      gbp_spell_dict_set_checker (self->dict, NULL);
+      self->language = NULL;
+      gspell_language_chooser_set_language (GSPELL_LANGUAGE_CHOOSER (self->language_chooser_button), NULL);
 
-  g_clear_object (&self->editor_view_addin);
+      g_clear_object (&self->editor_view_addin);
 
-  _gbp_spell_widget_update_actions (self);
+      _gbp_spell_widget_update_actions (self);
+    }
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]