GNOME Bugzilla – Bug 696479
gvfsmonitor.c: backend_died needs to take a ref while unsubscribing subscribers
Last modified: 2013-04-02 10:12:34 UTC
Created attachment 239662 [details] [review] Patch to fix bug Although this code hasn't changed in a long time, when exercised in 1.15.x in the mtp backend, it will reliably fail in the following way. When you unmount the MTP backend, a monitor happens to be in existence, for whatever reason, and the monitor has a weak ref on the backend that now fires. That monitor has one subscriber. It then turns out that the subscriber is holding the last ref to the monitor, so the act of unsubscribing it, releases the last ref on the monitor, causing it to be finalised. The code in backend_died then attempts to dereference the priv struct again and segfaults. This can easily be avoided by having backend_died hold a ref to the monitor while doing the unsubscribing.
Comment on attachment 239662 [details] [review] Patch to fix bug Right, looks good.