[dia] avoid crashing if the property dialog is closed before the color dialog



commit 6e63530280b71e8b00b8062c39a007c43c0bc1c1
Author: Hans Breuer <hans breuer org>
Date:   Fri Sep 10 15:40:18 2010 +0200

    avoid crashing if the property dialog is closed before the color dialog

 lib/widgets.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/lib/widgets.c b/lib/widgets.c
index b1de17f..5dd7dbc 100644
--- a/lib/widgets.c
+++ b/lib/widgets.c
@@ -1056,9 +1056,20 @@ dia_color_selector_more_callback(GtkWidget *widget, gpointer userdata)
   GString *palette = g_string_new ("");
 
   gchar *old_color = dia_dynamic_menu_get_entry(ddm);
+  GtkWidget *parent;
+
   /* Force history to the old place */
   dia_dynamic_menu_select_entry(ddm, old_color);
 
+  /* avoid crashing if the property dialog is closed before the color dialog */
+  parent = widget;
+  while (parent && !GTK_IS_WINDOW (parent))
+    parent = gtk_widget_get_parent (parent);
+  if (parent) {
+    gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW(parent));
+    gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+  }
+
   if (ddm->default_entries != NULL) {
     GList *tmplist;
     int index = 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]