[gtksourceview/wip/various-stuff: 2/2] Revert "Prevent construction of completion after dispose has run"
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/various-stuff: 2/2] Revert "Prevent construction of completion after dispose has run"
- Date: Sun, 26 Jan 2014 21:07:22 +0000 (UTC)
commit b7ebd4a3b4bffcf6a502447b34e45f3e84bdab69
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Jan 25 13:23:01 2014 +0100
Revert "Prevent construction of completion after dispose has run"
This reverts commit 89382601e772c0504ae7e5f709399f4dd3b0d291.
It was used in get_completion() to prevent the creation of
GtkSourceCompletion if dispose() has already run. But if
get_completion() is called in such a (rare) situation, it means that
GtkSourceView is still alive, and that dispose() will anyway be run a
second time, where g_clear_object() will clear the completion object a
second time if needed.
There was before a reference cycle between the view and completion, now
it is not the case anymore. This was maybe the root of the problem.
I've tested this commit with the following program, and everything is
fine, the completion is created and freed two times.
gint
main (gint argc, gchar *argv[])
{
GtkSourceView *view;
gtk_init (&argc, &argv);
view = GTK_SOURCE_VIEW (gtk_source_view_new ());
g_object_ref_sink (view);
gtk_source_view_get_completion (view);
g_message ("main: run dispose on view");
g_object_run_dispose (G_OBJECT (view));
gtk_source_view_get_completion (view);
g_message ("main: unref view");
g_object_unref (view);
return 0;
}
gtksourceview/gtksourceview.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 98193a1..78ad85f 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -163,7 +163,6 @@ struct _GtkSourceViewPrivate
guint show_right_margin : 1;
guint style_scheme_applied : 1;
guint current_line_color_set : 1;
- guint dispose_has_run : 1;
};
typedef struct _MarkCategory MarkCategory;
@@ -986,8 +985,6 @@ gtk_source_view_dispose (GObject *object)
g_clear_object (&view->priv->left_gutter);
g_clear_object (&view->priv->right_gutter);
- view->priv->dispose_has_run = 1;
-
G_OBJECT_CLASS (gtk_source_view_parent_class)->dispose (object);
}
@@ -4269,7 +4266,7 @@ gtk_source_view_get_completion (GtkSourceView *view)
{
g_return_val_if_fail (GTK_SOURCE_IS_VIEW (view), NULL);
- if (view->priv->completion == NULL && !view->priv->dispose_has_run)
+ if (view->priv->completion == NULL)
{
view->priv->completion = gtk_source_completion_new (view);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]