changeset 2329:47f8f950f377

GTK4: Fix crash by stopping processing after removing widget from the box.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 28 Feb 2021 13:42:25 +0000
parents 5363f953b22a
children 58700e9fcba3
files gtk4/dw.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gtk4/dw.c	Sun Feb 28 11:30:45 2021 +0000
+++ b/gtk4/dw.c	Sun Feb 28 13:42:25 2021 +0000
@@ -1853,6 +1853,7 @@
                   if(gtk_grid_get_child_at(GTK_GRID(box), 0, z) == handle2)
                   {
                      gtk_grid_remove_row(GTK_GRID(box), z);
+                     handle2 = NULL;
                      break;
                   }
                }
@@ -1864,6 +1865,7 @@
                   if(gtk_grid_get_child_at(GTK_GRID(box), z, 0) == handle2)
                   {
                      gtk_grid_remove_column(GTK_GRID(box), z);
+                     handle2 = NULL;
                      break;
                   }
                }
@@ -1879,7 +1881,7 @@
          /* Finally destroy the widget, make sure it is still
           * a valid widget if it got removed from the grid.
           */
-         if(GTK_IS_WIDGET(handle2))
+         if(handle2 && GTK_IS_WIDGET(handle2))
             g_object_unref(G_OBJECT(handle2));
       }
    }