changeset 2344:88f7e871b283

GTK3: Back port dw_window_destroy() fix from GTK4 and code cleanups.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 04 Mar 2021 03:05:56 +0000
parents 347b0f97c295
children a15bb7a2496e
files gtk3/dw.c
diffstat 1 files changed, 21 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/gtk3/dw.c	Thu Mar 04 02:00:23 2021 +0000
+++ b/gtk3/dw.c	Thu Mar 04 03:05:56 2021 +0000
@@ -2620,6 +2620,7 @@
                if(gtk_grid_get_child_at(GTK_GRID(box), 0, z) == handle2)
                {
                   gtk_grid_remove_row(GTK_GRID(box), z);
+                  handle2 = NULL;
                   break;
                }
             }
@@ -2631,6 +2632,7 @@
                if(gtk_grid_get_child_at(GTK_GRID(box), z, 0) == handle2)
                {
                   gtk_grid_remove_column(GTK_GRID(box), z);
+                  handle2 = NULL;
                   break;
                }
             }
@@ -2647,7 +2649,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))
          gtk_widget_destroy(handle2);
    }
    DW_MUTEX_UNLOCK;
@@ -7326,13 +7328,13 @@
             DW_MUTEX_UNLOCK;
             return;
          }
-   #if GTK_CHECK_VERSION(3,22,0)
+#if GTK_CHECK_VERSION(3,22,0)
          clip = gdk_window_get_clip_region(window);
          dc = gdk_window_begin_draw_frame(window, clip);
          cr = gdk_drawing_context_get_cairo_context(dc);
-   #else
+#else
          cr = gdk_cairo_create(window);
-   #endif
+#endif
       }
       else
       {
@@ -7398,13 +7400,13 @@
             DW_MUTEX_UNLOCK;
             return;
          }
-   #if GTK_CHECK_VERSION(3,22,0)
+#if GTK_CHECK_VERSION(3,22,0)
          clip = gdk_window_get_clip_region(window);
          dc = gdk_window_begin_draw_frame(window, clip);
          cr = gdk_drawing_context_get_cairo_context(dc);
-   #else
+#else
          cr = gdk_cairo_create(window);
-   #endif
+#endif
       }
       else
       {
@@ -7472,13 +7474,13 @@
             DW_MUTEX_UNLOCK;
             return;
          }
-   #if GTK_CHECK_VERSION(3,22,0)
+#if GTK_CHECK_VERSION(3,22,0)
          clip = gdk_window_get_clip_region(window);
          dc = gdk_window_begin_draw_frame(window, clip);
          cr = gdk_drawing_context_get_cairo_context(dc);
-   #else
+#else
          cr = gdk_cairo_create(window);
-   #endif
+#endif
       }
       else
       {
@@ -7554,13 +7556,13 @@
             DW_MUTEX_UNLOCK;
             return;
          }
-   #if GTK_CHECK_VERSION(3,22,0)
+#if GTK_CHECK_VERSION(3,22,0)
          clip = gdk_window_get_clip_region(window);
          dc = gdk_window_begin_draw_frame(window, clip);
          cr = gdk_drawing_context_get_cairo_context(dc);
-   #else
+#else
          cr = gdk_cairo_create(window);
-   #endif
+#endif
       }
       else
       {
@@ -7638,13 +7640,13 @@
             DW_MUTEX_UNLOCK;
             return;
          }
-   #if GTK_CHECK_VERSION(3,22,0)
+#if GTK_CHECK_VERSION(3,22,0)
          clip = gdk_window_get_clip_region(window);
          dc = gdk_window_begin_draw_frame(window, clip);
          cr = gdk_drawing_context_get_cairo_context(dc);
-   #else
+#else
          cr = gdk_cairo_create(window);
-   #endif
+#endif
       }
       else
       {
@@ -7734,13 +7736,13 @@
             DW_MUTEX_UNLOCK;
             return;
          }
-   #if GTK_CHECK_VERSION(3,22,0)
+#if GTK_CHECK_VERSION(3,22,0)
          clip = gdk_window_get_clip_region(window);
          dc = gdk_window_begin_draw_frame(window, clip);
          cr = gdk_drawing_context_get_cairo_context(dc);
-   #else
+#else
          cr = gdk_cairo_create(window);
-   #endif
+#endif
          if((tmpname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname")))
             fontname = tmpname;
       }