Correctly disconnect signals attached to the print job operation.

parent 97442bdc
......@@ -108,6 +108,14 @@ static guint print_job_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GeditPrintJob, gedit_print_job, G_TYPE_OBJECT)
static void end_print_cb (GtkPrintOperation *operation,
GtkPrintContext *context,
GeditPrintJob *job);
static void done_cb (GtkPrintOperation *operation,
GtkPrintOperationResult result,
GeditPrintJob *job);
static void
set_view (GeditPrintJob *job, GeditView *view)
{
......@@ -160,12 +168,6 @@ gedit_print_job_finalize (GObject *object)
g_free (job->priv->status_string);
if (job->priv->compositor != NULL)
g_object_unref (job->priv->compositor);
if (job->priv->operation != NULL)
g_object_unref (job->priv->operation);
G_OBJECT_CLASS (gedit_print_job_parent_class)->finalize (object);
}
......@@ -180,6 +182,22 @@ gedit_print_job_dispose (GObject *object)
job->priv->print_settings = NULL;
}
if (job->priv->compositor != NULL)
{
g_object_unref (job->priv->compositor);
job->priv->compositor = NULL;
}
if (job->priv->operation != NULL)
{
g_signal_handlers_disconnect_by_func (job->priv->operation,
end_print_cb, job);
g_signal_handlers_disconnect_by_func (job->priv->operation,
done_cb, job);
g_object_unref (job->priv->operation);
job->priv->operation = NULL;
}
G_OBJECT_CLASS (gedit_print_job_parent_class)->dispose (object);
}
......@@ -702,8 +720,11 @@ end_print_cb (GtkPrintOperation *operation,
GtkPrintContext *context,
GeditPrintJob *job)
{
if (job->priv->compositor != NULL)
{
g_object_unref (job->priv->compositor);
job->priv->compositor = NULL;
}
}
static void
......
......@@ -106,6 +106,11 @@ static guint signals[LAST_SIGNAL] = { 0 };
static gboolean gedit_tab_auto_save (GeditTab *tab);
static void done_printing_cb (GeditPrintJob *job,
GeditPrintJobResult result,
const GError *error,
GeditTab *tab);
static void
install_auto_save_timeout (GeditTab *tab)
{
......@@ -236,6 +241,15 @@ gedit_tab_dispose (GObject *object)
{
GeditTab *tab = GEDIT_TAB (object);
if (tab->priv->print_job != NULL)
{
g_signal_handlers_disconnect_by_func (tab->priv->print_job,
done_printing_cb, tab);
g_object_unref (tab->priv->print_job);
tab->priv->print_job = NULL;
tab->priv->print_preview = NULL;
}
if (tab->priv->tmp_save_location != NULL)
{
g_object_unref (tab->priv->tmp_save_location);
......@@ -2489,8 +2503,11 @@ done_printing_cb (GeditPrintJob *job,
view = gedit_tab_get_view (tab);
gtk_widget_grab_focus (GTK_WIDGET (view));
if (tab->priv->print_job != NULL)
{
g_object_unref (tab->priv->print_job);
tab->priv->print_job = NULL;
}
}
#if 0
......
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