diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-02-20 23:02:39 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-02-21 00:31:17 -0500 |
commit | c1ad7217b576d439be699d550e9b1c66802e6ba0 (patch) | |
tree | 6b1d33f3c1ff44982568971a8d9ddaa2a3b6ce3a | |
parent | f11d0118a338af2b07c1bbfc8887c1ba07d539cf (diff) | |
download | gtk+-c1ad7217b576d439be699d550e9b1c66802e6ba0.tar.gz |
notebook: Fix up ref counting
We need to keep a ref to the page objects.
-rw-r--r-- | gtk/gtknotebook.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index c9ea3bf72b..34ee81199c 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -4216,7 +4216,7 @@ gtk_notebook_insert_notebook_page (GtkNotebook *notebook, if ((position < 0) || (position > nchildren)) position = nchildren; - priv->children = g_list_insert (priv->children, page, position); + priv->children = g_list_insert (priv->children, g_object_ref (page), position); if (position < nchildren) sibling = GTK_NOTEBOOK_PAGE_FROM_LIST (g_list_nth (priv->children, position))->tab_widget; @@ -4305,6 +4305,7 @@ gtk_notebook_real_insert_page (GtkNotebook *notebook, gint position) { GtkNotebookPage *page; + int ret; page = g_object_new (GTK_TYPE_NOTEBOOK_PAGE, "child", child, @@ -4312,7 +4313,11 @@ gtk_notebook_real_insert_page (GtkNotebook *notebook, "menu", menu_label, NULL); - return gtk_notebook_insert_notebook_page (notebook, page, position); + ret = gtk_notebook_insert_notebook_page (notebook, page, position); + + g_object_unref (page); + + return ret; } static gboolean |