[gnome-bluetooth] lib: Fix potential crasher in test application



commit 2a07926e6f27a1ce14a21ca3a655f850af77c03f
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Aug 18 16:49:31 2014 +0200

    lib: Fix potential crasher in test application

 lib/test-deviceselection.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/lib/test-deviceselection.c b/lib/test-deviceselection.c
index e4c5806..682524e 100644
--- a/lib/test-deviceselection.c
+++ b/lib/test-deviceselection.c
@@ -143,6 +143,8 @@ create_phone_dialogue (const char *bdaddr)
        g_signal_connect (G_OBJECT (dialog), "response",
                          G_CALLBACK (gtk_main_quit), NULL);
 
+       g_object_add_weak_pointer (G_OBJECT(dialog), (gpointer *) (&dialog));
+
        return dialog;
 }
 
@@ -415,7 +417,8 @@ int main(int argc, char **argv)
 
        gtk_main ();
 
-       gtk_widget_destroy(dialog);
+       if (dialog)
+               gtk_widget_destroy(dialog);
 
        return 0;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]