[gnome-bluetooth] lib: Fix crash when exiting panel during pairing
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: Fix crash when exiting panel during pairing
- Date: Fri, 25 Aug 2017 17:52:32 +0000 (UTC)
commit 25ba10e48f5a7294e4bc8173e982a317190c03c7
Author: Bastien Nocera <hadess hadess net>
Date: Fri Aug 25 19:43:22 2017 +0200
lib: Fix crash when exiting panel during pairing
When cancelling a pairing, make sure not to access user_data that might
not be valid anymore.
This code tried to access priv without it being set, as well as
trying to access before checking the result of the operation (which
might be "cancelled" meaning we shouldn't try to touch the UI).
#0 0x00007f5ef0671ac7 in gtk_widget_destroy (widget=0xaaaaaaaaaaaaaaaa) at
.../jhbuild/gtk+-3/gtk/gtkwidget.c:4719
#1 0x00007f5ef0fd1ab3 in create_callback (source_object=0x2017120, res=0x205a250, user_data=0x1de3460)
at .../jhbuild/gnome-bluetooth/lib/bluetooth-settings-widget.c:897
#2 0x00007f5eeed8a9e8 in g_simple_async_result_complete (simple=0x205a250) at
.../jhbuild/glib/gio/gsimpleasyncresult.c:801
lib/bluetooth-settings-widget.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index 1730596..f6f5418 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -894,10 +894,6 @@ create_callback (GObject *source_object,
ret = bluetooth_client_setup_device_finish (BLUETOOTH_CLIENT (source_object),
res, &path, &error);
- g_clear_pointer (&priv->pairing_dialog, gtk_widget_destroy);
-
- g_hash_table_remove (priv->pairing_devices, path);
-
/* Create failed */
if (ret == FALSE) {
//char *text;
@@ -934,6 +930,10 @@ create_callback (GObject *source_object,
priv = BLUETOOTH_SETTINGS_WIDGET_GET_PRIVATE (user_data);
+ g_clear_pointer (&priv->pairing_dialog, gtk_widget_destroy);
+
+ g_hash_table_remove (priv->pairing_devices, path);
+
bluetooth_client_set_trusted (BLUETOOTH_CLIENT (source_object), path, TRUE);
data = g_new0 (SetupConnectData, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]