[Bug 21097] proxy subclasses should support optional features

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Apr 6 20:57:44 CEST 2010


https://bugs.freedesktop.org/show_bug.cgi?id=21097

--- Comment #12 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2010-04-06 11:57:44 PDT ---
(In reply to comment #10)
> (In reply to comment #5)
> > The rationale is that this is the safe way to do weak refs. As long as only a
> > weak ref is held, the object's last ref could be released at any time, by any
> > call into user-supplied code (notably, any signal emission!); temporarily
> > strengthening the ref fixes this.
> 
> I'm not sure to understand this. If the callback is called the object is still
> alive right? So, how can it be destroyed while I'm in the callback? Or are you
> considering multi-threated code?

* Badger calls an async method, with a TpWeakRef for itself as user_data
* Mushroom holds the last ref to Badger, and is connected to
Badger::oscillating
* The callback for the async method looks like this:

  badger_connection_prepared_cb (...)
  {
    Badger *self = tp_weak_ref_get_object (user_data);

    ...
    g_signal_emit_by_name (self, "oscillating", 60 /* Hz */);
    ...
    badger_check_for_snakes (self);
  }

* In the callback for Badger::oscillating, Mushroom releases the reference it
had
* The call to badger_check_for_snakes() is now a use-after-free

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the telepathy-bugs mailing list