Commit 880bc9f3 authored by Felipe Borges's avatar Felipe Borges 👣

printers: Fix crash when panel is closed quickly

Fix a user-after-free while testing the connectivity to a cups
server. This is similar to the fix in commit 1d72a0b3.

This is an addition to the changes introduced in commit 2ff5cfd6
which allowed the connection testing to be cancellable.

Fixes #51
Fixes https://bugzilla.gnome.org/794632
parent c1861239
Pipeline #8427 passed with stages
in 11 minutes and 13 seconds
......@@ -1229,14 +1229,13 @@ connection_test_cb (GObject *source_object,
gpointer user_data)
{
CcPrintersPanelPrivate *priv;
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
CcPrintersPanel *self;
gboolean success;
PpCups *cups = PP_CUPS (source_object);
g_autoptr(GError) error = NULL;
priv = self->priv;
success = pp_cups_connection_test_finish (cups, result, &error);
g_object_unref (cups);
if (error != NULL)
{
......@@ -1244,15 +1243,18 @@ connection_test_cb (GObject *source_object,
{
g_warning ("Could not test connection: %s", error->message);
}
return;
}
self = CC_PRINTERS_PANEL (user_data);
priv = self->priv;
if (!success)
{
priv->cups_status_check_id =
g_timeout_add_seconds (CUPS_STATUS_CHECK_INTERVAL, cups_status_check, self);
}
g_object_unref (cups);
}
static void
......
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