summaryrefslogtreecommitdiff
path: root/gtk/gtknotebook.c
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2002-02-09 22:12:04 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2002-02-09 22:12:04 +0000
commitdc46b476e38e3cc0461cf97e4d7d16ec59f4cb29 (patch)
tree6735e92a13cd58a17bac0b33d11dba386662dbeb /gtk/gtknotebook.c
parent1e40b8cb180ed58629b7a761eb3582bf52895afa (diff)
downloadgdk-pixbuf-dc46b476e38e3cc0461cf97e4d7d16ec59f4cb29.tar.gz
Avoid segfault for selectable tab labels (even without a segfault, they
* gtk/gtknotebook.c (gtk_notebook_set_focus_child): Avoid segfault for selectable tab labels (even without a segfault, they make the notebook almost unusable, though). (#69985) * gtk/gtkmenuitem.c (gtk_menu_item_set_accel_path): Silently do nothing if the parent is not a menu. (#66492) * gtk/gtkitemfactory.c (gtk_item_factory_from_widget, gtk_item_factory_path_from_widget): Try fetching the return value from menu_item->submenu as a fallback. (#69020)
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r--gtk/gtknotebook.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index e0872bb84..269d796c0 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2068,7 +2068,7 @@ gtk_notebook_focus (GtkWidget *widget,
g_assert_not_reached ();
return FALSE;
}
-
+
static void
gtk_notebook_set_focus_child (GtkContainer *container,
GtkWidget *child)
@@ -2091,15 +2091,18 @@ gtk_notebook_set_focus_child (GtkContainer *container,
if (page_child->parent == GTK_WIDGET (container))
{
GList *list = gtk_notebook_find_child (notebook, page_child, NULL);
- GtkNotebookPage *page = list->data;
-
- if (page->last_focus_child)
- g_object_remove_weak_pointer (G_OBJECT (page->last_focus_child), (gpointer *)&page->last_focus_child);
-
- page->last_focus_child = GTK_WINDOW (toplevel)->focus_widget;
- g_object_add_weak_pointer (G_OBJECT (page->last_focus_child), (gpointer *)&page->last_focus_child);
+ if (list != NULL)
+ {
+ GtkNotebookPage *page = list->data;
- break;
+ if (page->last_focus_child)
+ g_object_remove_weak_pointer (G_OBJECT (page->last_focus_child), (gpointer *)&page->last_focus_child);
+
+ page->last_focus_child = GTK_WINDOW (toplevel)->focus_widget;
+ g_object_add_weak_pointer (G_OBJECT (page->last_focus_child), (gpointer *)&page->last_focus_child);
+
+ break;
+ }
}
page_child = page_child->parent;