changeset 2057:9c400365f269

GTK3: Eliminate warnings generated when calling dw_window_destroy() on widgets that happen to be packed into a grid widget. If removed from the grid they no longer need to be destroyed.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 14 Dec 2019 15:08:18 +0000
parents 29305f8abae3
children f8865a4b5835
files gtk3/dw.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gtk3/dw.c	Sat Dec 07 04:16:35 2019 +0000
+++ b/gtk3/dw.c	Sat Dec 14 15:08:18 2019 +0000
@@ -2542,8 +2542,11 @@
             g_object_set_data(G_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount));
          }
       }
-      /* Finally destroy the widget */
-      gtk_widget_destroy(handle2);
+      /* Finally destroy the widget, make sure it is still
+       * a valid widget if it got removed from the grid.
+       */
+      if(GTK_IS_WIDGET(handle2))
+         gtk_widget_destroy(handle2);
    }
    DW_MUTEX_UNLOCK;
    return 0;