Commit 3f26314d authored by Matthias Clasen's avatar Matthias Clasen

Bug 531008 – Crash in gtkprintunixdialog.c

        * gtk/gtkprintunixdialog.c: Disconnect signal handlers when
        the dialog closes. Patch by Yevgen Muntyan.


svn path=/trunk/; revision=20186
parent fd5035c2
2008-05-27 Matthias Clasen <mclasen@redhat.com>
Bug 531008 – Crash in gtkprintunixdialog.c
* gtk/gtkprintunixdialog.c: Disconnect signal handlers when
the dialog closes. Patch by Yevgen Muntyan.
2008-05-27 Matthias Clasen <mclasen@redhat.com> 2008-05-27 Matthias Clasen <mclasen@redhat.com>
RH bug 248245: cups client printing from gnome applications fail RH bug 248245: cups client printing from gnome applications fail
......
...@@ -195,6 +195,7 @@ struct GtkPrintUnixDialogPrivate ...@@ -195,6 +195,7 @@ struct GtkPrintUnixDialogPrivate
GList *print_backends; GList *print_backends;
GtkPrinter *current_printer; GtkPrinter *current_printer;
GtkPrinter *request_details_printer;
guint request_details_tag; guint request_details_tag;
GtkPrinterOptionSet *options; GtkPrinterOptionSet *options;
gulong options_changed_handler; gulong options_changed_handler;
...@@ -449,6 +450,21 @@ gtk_print_unix_dialog_destroy (GtkPrintUnixDialog *dialog) ...@@ -449,6 +450,21 @@ gtk_print_unix_dialog_destroy (GtkPrintUnixDialog *dialog)
clear_per_printer_ui (dialog); clear_per_printer_ui (dialog);
} }
static void
disconnect_printer_details_request (GtkPrintUnixDialog *dialog)
{
GtkPrintUnixDialogPrivate *priv = dialog->priv;
if (priv->request_details_tag)
{
g_signal_handler_disconnect (priv->request_details_printer,
priv->request_details_tag);
priv->request_details_tag = 0;
g_object_unref (priv->request_details_printer);
priv->request_details_printer = NULL;
}
}
static void static void
gtk_print_unix_dialog_finalize (GObject *object) gtk_print_unix_dialog_finalize (GObject *object)
{ {
...@@ -458,13 +474,8 @@ gtk_print_unix_dialog_finalize (GObject *object) ...@@ -458,13 +474,8 @@ gtk_print_unix_dialog_finalize (GObject *object)
GList *node; GList *node;
unschedule_idle_mark_conflicts (dialog); unschedule_idle_mark_conflicts (dialog);
disconnect_printer_details_request (dialog);
if (priv->request_details_tag)
{
g_source_remove (priv->request_details_tag);
priv->request_details_tag = 0;
}
if (priv->current_printer) if (priv->current_printer)
{ {
g_object_unref (priv->current_printer); g_object_unref (priv->current_printer);
...@@ -1358,7 +1369,7 @@ printer_details_acquired (GtkPrinter *printer, ...@@ -1358,7 +1369,7 @@ printer_details_acquired (GtkPrinter *printer,
{ {
GtkPrintUnixDialogPrivate *priv = dialog->priv; GtkPrintUnixDialogPrivate *priv = dialog->priv;
priv->request_details_tag = 0; disconnect_printer_details_request (dialog);
if (success) if (success)
{ {
...@@ -1385,13 +1396,9 @@ selected_printer_changed (GtkTreeSelection *selection, ...@@ -1385,13 +1396,9 @@ selected_printer_changed (GtkTreeSelection *selection,
g_free (priv->waiting_for_printer); g_free (priv->waiting_for_printer);
priv->waiting_for_printer = NULL; priv->waiting_for_printer = NULL;
} }
if (priv->request_details_tag) disconnect_printer_details_request (dialog);
{
g_source_remove (priv->request_details_tag);
priv->request_details_tag = 0;
}
printer = NULL; printer = NULL;
if (gtk_tree_selection_get_selected (selection, NULL, &filter_iter)) if (gtk_tree_selection_get_selected (selection, NULL, &filter_iter))
{ {
...@@ -1410,8 +1417,9 @@ selected_printer_changed (GtkTreeSelection *selection, ...@@ -1410,8 +1417,9 @@ selected_printer_changed (GtkTreeSelection *selection,
priv->request_details_tag = priv->request_details_tag =
g_signal_connect (printer, "details-acquired", g_signal_connect (printer, "details-acquired",
G_CALLBACK (printer_details_acquired), dialog); G_CALLBACK (printer_details_acquired), dialog);
/* take the reference */
priv->request_details_printer = printer;
gtk_printer_request_details (printer); gtk_printer_request_details (printer);
g_object_unref (printer);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment