printers: Don't crash after changing an option

Use GCancellable when setting a new value of an option.
This prevents Printers panel from crash caused by
calling of option widget's callback on finalized widget.

https://bugzilla.gnome.org/show_bug.cgi?id=694874
This commit is contained in:
Marek Kasik 2013-02-28 16:19:21 +01:00
parent affe13b180
commit 76d18ec85d
3 changed files with 68 additions and 7 deletions

View file

@ -3347,7 +3347,8 @@ printer_add_option_async_dbus_cb (GObject *source_object,
g_error_free (error);
}
data->callback (success, data->user_data);
if (!g_cancellable_is_cancelled (data->cancellable))
data->callback (success, data->user_data);
if (data->cancellable)
g_object_unref (data->cancellable);
@ -3386,7 +3387,8 @@ printer_add_option_async (const gchar *printer_name,
}
data = g_new0 (PAOData, 1);
data->cancellable = cancellable;
if (cancellable)
data->cancellable = g_object_ref (cancellable);
data->callback = callback;
data->user_data = user_data;