[gtk+] gtknotebook: Add more non-NULL checks for cur_page



commit d65ccf96ee43e3cd62a705074d452f9f87912ee2
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Mar 10 08:34:39 2015 +0000

    gtknotebook: Add more non-NULL checks for cur_page
    
    These were not spotted by scan-build, but from some brief mental
    reasoning could potentially be problem areas.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=712760

 gtk/gtknotebook.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 8898260..9f6b51f 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -3401,7 +3401,7 @@ scroll_notebook_timer (gpointer data)
   first_tab = gtk_notebook_search_page (notebook, priv->first_tab,
                                         (pointer_position == POINTER_BEFORE) ? STEP_PREV : STEP_NEXT,
                                         TRUE);
-  if (first_tab)
+  if (first_tab && priv->cur_page)
     {
       priv->first_tab = first_tab;
       gtk_notebook_pages_allocate (notebook);
@@ -3692,6 +3692,8 @@ gtk_notebook_drag_begin (GtkWidget        *widget,
       priv->dnd_timer = 0;
     }
 
+  g_assert (priv->cur_page != NULL);
+
   priv->operation = DRAG_OPERATION_DETACH;
   gtk_notebook_pages_allocate (notebook);
 
@@ -3827,6 +3829,8 @@ gtk_notebook_drag_motion (GtkWidget      *widget,
       goto out;
     }
 
+  g_assert (priv->cur_page != NULL);
+
   stop_scrolling (notebook);
   target = gtk_drag_dest_find_target (widget, context, NULL);
   tab_target = gdk_atom_intern_static_string ("GTK_NOTEBOOK_TAB");
@@ -6096,6 +6100,8 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
   GtkAllocation child_allocation = { 0, };
   GtkOrientation tab_expand_orientation;
 
+  g_assert (priv->cur_page != NULL);
+
   widget = GTK_WIDGET (notebook);
   container = GTK_CONTAINER (notebook);
   gtk_widget_style_get (widget, "tab-overlap", &tab_overlap, NULL);


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