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 641706 - discoverer: Keep references on discoverer objects for callbacks
discoverer: Keep references on discoverer objects for callbacks
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
unspecified
Other All
: Normal normal
: 0.10.33
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-02-07 09:51 UTC by Arun Raghavan
Modified: 2011-02-22 12:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
discoverer: Use g_signal_connect_object instead of g_signal_connect (2.35 KB, patch)
2011-02-07 09:53 UTC, Arun Raghavan
none Details | Review
discoverer: Keep a ref for the async timeout callback (1.77 KB, patch)
2011-02-07 09:53 UTC, Arun Raghavan
committed Details | Review
discoverer: Use g_signal_connect_object instead of g_signal_connect (3.75 KB, patch)
2011-02-08 09:59 UTC, Arun Raghavan
none Details | Review
discoverer: Use g_signal_connect_object instead of g_signal_connect (3.89 KB, patch)
2011-02-17 18:48 UTC, Arun Raghavan
committed Details | Review

Description Arun Raghavan 2011-02-07 09:51:45 UTC
Attaching a couple of patches that make sure we don't crash if the discoverer object disappears when there is a pending callback. The actual crashes are only exposed if commit e730ce71 is reverted, but should still be included for correctness.
Comment 1 Arun Raghavan 2011-02-07 09:53:08 UTC
Created attachment 180277 [details] [review]
discoverer: Use g_signal_connect_object instead of g_signal_connect

We want to make sure the discoverer object passed to the various
callbacks doesn't become invalid if a callback is pending and the object
is free'd in the mean time.
Comment 2 Arun Raghavan 2011-02-07 09:53:12 UTC
Created attachment 180278 [details] [review]
discoverer: Keep a ref for the async timeout callback

This makes sure we maintain a ref on the discoverer object while the
async timeout callback is alive to prevent a potential crash if the
object is freed while the callback is pending.
Comment 3 Olivier Crête 2011-02-07 15:46:20 UTC
Btw, you're aware that g_signal_connect_object() will leak something. tp-glib has a hack around that (tp_g_signal_connect_object()).. But ideally it should be fixed in GLib itself I guess.
Comment 4 Arun Raghavan 2011-02-08 09:59:07 UTC
Comment on attachment 180277 [details] [review]
discoverer: Use g_signal_connect_object instead of g_signal_connect

Attaching a new patch which fixes the potential leak pointed out by Olivier.
Comment 5 Arun Raghavan 2011-02-08 09:59:33 UTC
Created attachment 180374 [details] [review]
discoverer: Use g_signal_connect_object instead of g_signal_connect

We want to make sure the discoverer object passed to the various
callbacks doesn't become invalid if a callback is pending and the object
is free'd in the mean time.
Comment 6 Arun Raghavan 2011-02-09 11:02:16 UTC
Comment on attachment 180374 [details] [review]
discoverer: Use g_signal_connect_object instead of g_signal_connect

This patch is wrong as well (throws up asserts that I somehow missed). Will update.
Comment 7 Arun Raghavan 2011-02-17 18:48:29 UTC
Created attachment 181159 [details] [review]
discoverer: Use g_signal_connect_object instead of g_signal_connect

We want to make sure the discoverer object passed to the various
callbacks doesn't become invalid if a callback is pending and the object
is free'd in the mean time.
Comment 8 Edward Hervey 2011-02-22 12:45:44 UTC
All ok from me. Please commit.
Comment 9 Edward Hervey 2011-02-22 12:50:01 UTC
commit 8d2b69384a2674873975b5414f7bb3635ff2014b
Author: Arun Raghavan <arun.raghavan@collabora.co.uk>
Date:   Mon Feb 7 13:04:55 2011 +0530

    discoverer: Keep a ref for the async timeout callback
    
    This makes sure we maintain a ref on the discoverer object while the
    async timeout callback is alive to prevent a potential crash if the
    object is freed while the callback is pending.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641706

commit 40c4fe8fbe23cc3e3293c737969fc274dfb6c4f1
Author: Arun Raghavan <arun.raghavan@collabora.co.uk>
Date:   Mon Feb 7 13:57:39 2011 +0530

    discoverer: Use g_signal_connect_object instead of g_signal_connect
    
    We want to make sure the discoverer object passed to the various
    callbacks doesn't become invalid if a callback is pending and the object
    is free'd in the mean time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641706