[gnumeric] GUI: Plug leak.



commit 1a94a5f6bcd0fc7fd410ed4cdfed7c572b36f243
Author: Morten Welinder <terra gnome org>
Date:   Tue Feb 22 15:14:25 2011 -0500

    GUI: Plug leak.

 src/dialogs/ChangeLog               |    4 ++++
 src/dialogs/dialog-search-replace.c |   22 ++++++++++------------
 2 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index f1b551a..a715c44 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-22  Morten Welinder  <terra gnome org>
+
+	* dialog-search-replace.c (dialog_search_replace): Plug leak.
+
 2011-02-18  Morten Welinder  <terra gnome org>
 
 	* dialog-cell-format.c (build_validation_error_combo): Don't leak
diff --git a/src/dialogs/dialog-search-replace.c b/src/dialogs/dialog-search-replace.c
index 1f01ef6..559353b 100644
--- a/src/dialogs/dialog-search-replace.c
+++ b/src/dialogs/dialog-search-replace.c
@@ -227,17 +227,6 @@ range_focused (G_GNUC_UNUSED GtkWidget *widget,
 	return FALSE;
 }
 
-static void
-non_modal_dialog (WBCGtk *wbcg,
-		  GtkDialog *dialog,
-		  const char *key)
-{
-	gnumeric_keyed_dialog (wbcg, GTK_WINDOW (dialog), key);
-
-	gtk_widget_show (GTK_WIDGET (dialog));
-}
-
-
 void
 dialog_search_replace (WBCGtk *wbcg,
 		       SearchDialogCallback cb)
@@ -263,6 +252,9 @@ dialog_search_replace (WBCGtk *wbcg,
 
 	dialog = GTK_DIALOG (go_gtk_builder_get_widget (gui, "search_replace_dialog"));
 
+	/* Fairly silly: we need to destroy the other dialog in the file. */
+	gtk_widget_destroy (go_gtk_builder_get_widget (gui, "query_dialog"));
+
 	dd = g_new (DialogState, 1);
 	dd->wbcg = wbcg;
 	dd->gui = gui;
@@ -360,7 +352,9 @@ dialog_search_replace (WBCGtk *wbcg,
 					   GNM_DIALOG_DESTROY_SHEET_REMOVED);
 
 	wbc_gtk_attach_guru (wbcg, GTK_WIDGET (dialog));
-	non_modal_dialog (wbcg, dialog, SEARCH_REPLACE_KEY);
+
+	gnumeric_keyed_dialog (wbcg, GTK_WINDOW (dialog), SEARCH_REPLACE_KEY);
+	gtk_widget_show (GTK_WIDGET (dialog));
 }
 
 int
@@ -382,6 +376,9 @@ dialog_search_replace_query (WBCGtk *wbcg,
 
 	dialog = GTK_DIALOG (go_gtk_builder_get_widget (gui, "query_dialog"));
 
+	/* Fairly silly: we need to destroy the other dialog in the file. */
+	gtk_widget_destroy (go_gtk_builder_get_widget (gui, "search_replace_dialog"));
+
 	gtk_entry_set_text (GTK_ENTRY (go_gtk_builder_get_widget (gui, "qd_location")),
 			    location);
 	gtk_entry_set_text (GTK_ENTRY (go_gtk_builder_get_widget (gui, "qd_old_text")),
@@ -409,6 +406,7 @@ dialog_search_replace_query (WBCGtk *wbcg,
 	}
 
 	gtk_widget_destroy (GTK_WIDGET (dialog));
+	g_object_unref (gui);
 
 	return res;
 }



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