After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793505 - lib: Fix possible crash on startup
lib: Fix possible crash on startup
Status: RESOLVED FIXED
Product: gnome-bluetooth
Classification: Core
Component: properties
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-bluetooth-general-maint@gnome.bugs
gnome-bluetooth-general-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2018-02-16 10:00 UTC by Bastien Nocera
Modified: 2018-02-16 11:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
lib: Fix possible crash on startup (2.48 KB, patch)
2018-02-16 10:01 UTC, Bastien Nocera
committed Details | Review
lib: Make ObjectManager creation cancellable (1.88 KB, patch)
2018-02-16 10:54 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2018-02-16 10:00:50 UTC
.
Comment 1 Bastien Nocera 2018-02-16 10:01:07 UTC
Created attachment 368408 [details] [review]
lib: Fix possible crash on startup

Fix possible crash when the object creation is cancelled on startup. We
shouldn't be using user_data until we know that the call has not been
cancelled, otherwise we could be accessing already freed memory.

 #0  g_type_check_instance_cast (type_instance=type_instance@entry=0x208dc60, iface_type=34189312) at /home/hadess/Projects/jhbuild/glib/gobject/gtype.c:4057
 #1  0x00007f34c8d09522 in object_manager_new_callback (source_object=<optimized out>, res=0x208c390, user_data=user_data@entry=0x208dc60)
     at ../../../../Projects/jhbuild/gnome-bluetooth/lib/bluetooth-client.c:761
 #2  0x00007f34ce7d819a in g_task_return_now (task=0x208c390) at /home/hadess/Projects/jhbuild/glib/gio/gtask.c:1148
 #3  0x00007f34ce7d81d9 in complete_in_idle_cb (task=task@entry=0x208c390) at /home/hadess/Projects/jhbuild/glib/gio/gtask.c:1162
Comment 2 Bastien Nocera 2018-02-16 10:54:11 UTC
Created attachment 368409 [details] [review]
lib: Make ObjectManager creation cancellable

So that we can stop the creation as soon as the BluetoothClient
is disposed of, rather than waiting for the call to finish.
Comment 3 Benjamin Berg 2018-02-16 11:02:03 UTC
Review of attachment 368409 [details] [review]:

lgtm
Comment 4 Benjamin Berg 2018-02-16 11:02:54 UTC
Review of attachment 368408 [details] [review]:

could clear the cancellable, but that isn't really an issue
Comment 5 Bastien Nocera 2018-02-16 11:13:35 UTC
(In reply to Benjamin Berg from comment #4)
> Review of attachment 368408 [details] [review] [review]:
> 
> could clear the cancellable, but that isn't really an issue

We could, but we could use it for other internal calls (if we add more) that don't have their own cancellables.
Comment 6 Bastien Nocera 2018-02-16 11:15:25 UTC
Attachment 368408 [details] pushed as c5190d3 - lib: Fix possible crash on startup
Attachment 368409 [details] pushed as 3f109f3 - lib: Make ObjectManager creation cancellable