GNOME Bugzilla – Bug 682099
Crash occurs destroying an GUPnPContextManager object after expiry of resources
Last modified: 2019-02-22 09:29:12 UTC
Created attachment 221602 [details] [review] Patch to prevent signals with NULL parameters being emitted by GSSDP Hi All, I sometimes get a crash in gupnp when I close down my application. This happens when unreffing my GUPnPContextManager. I'm using the linux context manager but I'm not sure the particular context manager in use is important. Here is the backtrace.
+ Trace 230687
Although the crash is happening in GUPnP I think the bug is actually in GSSDP. The crash seems to occur after a Resource object expires. When this happens a signal is emitted, the Resource object's USN is deleted and set to NULL and attempt is made to remove the Resource object from the resource_browser->priv->resources hash table. This all happens in resource_expire. The problem seems to be that there is a bug in resource_expire which sometimes prevents the Resource object being removed from the resource_browser->priv->resources hash table. This causes a problem later on when the ContextManager is deleted. During the destruction of the ContextManager a signal is emitted with the USN of each resource left in resource_browser->priv->resources. The problem is that the expired resources are still in this list and their USN is set to NULL. The signal results in the passing of a NULL usn parameter to parse_usn in GUPnP which crashes as it is not expecting to receive NULL parameters. I hope this analysis is correct. Assuming that it is, please find attached a patch that should fix the problem.
Ah, dread, that's fallout from 4ad03d. Fix looks ok; I'll write a test for this and apply the patch later. Thank you.