summaryrefslogtreecommitdiff
path: root/frontends/gtk/tabs.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-10-13 01:52:22 +0100
committerVincent Sanders <vince@kyllikki.org>2019-10-13 01:52:22 +0100
commit6e31dcaec4a88ec1da3ae60e114fa256b77e5597 (patch)
tree01cdaa728e05ee8ca8e217707eee5c10c3bc804d /frontends/gtk/tabs.c
parentc82049eb84250330b28b29fc327d12a4b5f8a77f (diff)
downloadnetsurf-6e31dcaec4a88ec1da3ae60e114fa256b77e5597.tar.gz
netsurf-6e31dcaec4a88ec1da3ae60e114fa256b77e5597.tar.bz2
ensure gtk scaffolding destruction does not create memory errors
Diffstat (limited to 'frontends/gtk/tabs.c')
-rw-r--r--frontends/gtk/tabs.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/frontends/gtk/tabs.c b/frontends/gtk/tabs.c
index 54aa5faf4..76fd02f89 100644
--- a/frontends/gtk/tabs.c
+++ b/frontends/gtk/tabs.c
@@ -312,14 +312,19 @@ nsgtk_tab_add_newtab(GtkNotebook *notebook)
static void
nsgtk_tab_visibility_update(GtkNotebook *notebook, GtkWidget *child, guint page)
{
- gint pagec = gtk_notebook_get_n_pages(notebook);
- GtkWidget *addpage = g_object_get_data(G_OBJECT(notebook), "addtab");
-
- if (addpage != NULL) {
- pagec--; /* skip the add tab */
- if ((gint)page == pagec) {
- /* ensure the add new tab cannot be current */
- gtk_notebook_set_current_page(notebook, page - 1);
+ gint pagec;
+ GtkWidget *addpage;
+
+ pagec = gtk_notebook_get_n_pages(notebook);
+ if (pagec > 1) {
+ addpage = g_object_get_data(G_OBJECT(notebook), "addtab");
+ if (addpage != NULL) {
+ pagec--; /* skip the add tab */
+ if ((gint)page == pagec) {
+ /* ensure the add new tab cannot be current */
+ gtk_notebook_set_current_page(notebook,
+ page - 1);
+ }
}
}