[gtksourceview] hoverassistant: dont toggle visibility after disposal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] hoverassistant: dont toggle visibility after disposal
- Date: Thu, 1 Sep 2022 01:00:03 +0000 (UTC)
commit fc72fa35ccfacbc7b2ab22103e4e90f05e777a41
Author: Christian Hergert <chergert redhat com>
Date: Wed Aug 31 12:37:37 2022 -0700
hoverassistant: dont toggle visibility after disposal
Avoid a race condition if we are force disposed while the action is
processed. Doesn't happen in practice, but I'd prefer to be explicit here.
gtksourceview/gtksourcehoverassistant.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcehoverassistant.c b/gtksourceview/gtksourcehoverassistant.c
index 7de6cb81..1abe01bc 100644
--- a/gtksourceview/gtksourcehoverassistant.c
+++ b/gtksourceview/gtksourcehoverassistant.c
@@ -52,6 +52,8 @@ struct _GtkSourceHoverAssistant
gulong root_leave_handler;
GSource *dismiss_source;
+
+ guint disposed : 1;
};
G_DEFINE_TYPE (GtkSourceHoverAssistant, gtk_source_hover_assistant, GTK_SOURCE_TYPE_ASSISTANT)
@@ -289,6 +291,8 @@ gtk_source_hover_assistant_dispose (GObject *object)
{
GtkSourceHoverAssistant *self = (GtkSourceHoverAssistant *)object;
+ self->disposed = TRUE;
+
self->display = NULL;
g_clear_pointer (&self->dismiss_source, g_source_destroy);
@@ -360,8 +364,11 @@ gtk_source_hover_assistant_populate_cb (GObject *object,
if (_gtk_source_hover_context_populate_finish (context, result, &error))
{
- gtk_widget_set_visible (GTK_WIDGET (self),
- !_gtk_source_hover_display_is_empty (self->display));
+ if (!self->disposed)
+ {
+ gtk_widget_set_visible (GTK_WIDGET (self),
+ !_gtk_source_hover_display_is_empty (self->display));
+ }
}
g_clear_object (&self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]