diff options
author | Felipe Borges <felipeborges@gnome.org> | 2018-04-09 11:42:35 +0200 |
---|---|---|
committer | Felipe Borges <felipeborges@gnome.org> | 2018-04-09 11:49:15 +0200 |
commit | 7cd807893677a45806fdd106694b2efca8f750b8 (patch) | |
tree | 34809434eb2d339d78e4de559073d9ad4f1fa711 | |
parent | 02b0d5931cf3ef1c055c6d864dd58dfd481bbead (diff) | |
download | gnome-control-center-7cd807893677a45806fdd106694b2efca8f750b8.tar.gz |
printers: Fix crash when panel is closed quicklyprinters-fix-crash-when-closing-quicky
Fix a user-after-free while testing the connectivity to a cups
server. This is similar to the fix in commit 1d72a0b.
This is an addition to the changes introduced in commit 2ff5cfd
which allowed the connection testing to be cancellable.
Fixes #51
Fixes https://bugzilla.gnome.org/794632
-rw-r--r-- | panels/printers/cc-printers-panel.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c index 4815c4520..b9b2ca82b 100644 --- a/panels/printers/cc-printers-panel.c +++ b/panels/printers/cc-printers-panel.c @@ -1230,13 +1230,11 @@ 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); if (error != NULL) @@ -1244,9 +1242,14 @@ connection_test_cb (GObject *source_object, if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { 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 = |