# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1614827156 0 # Node ID 88f7e871b283041e8a8d56d2b30faa0c425c0e09 # Parent 347b0f97c2952a872fe74521536eb94e3245f08e GTK3: Back port dw_window_destroy() fix from GTK4 and code cleanups. diff -r 347b0f97c295 -r 88f7e871b283 gtk3/dw.c --- 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; }