Revision 72ed9e04394746495f021133915e6bf7c1d3b5b1 authored by Michael Catanzaro on 25 May 2019, 23:30:12 UTC, committed by Michael Catanzaro on 26 May 2019, 15:17:15 UTC
The GTask must be destroyed on the thread that is running its GMainContext, i.e. the thread that started the task. It must never be destroyed on the actual task thread when running with g_task_run_in_thread(), because when it is destroyed, it will unref its source object and destroy its user data (if a GDestroyNotify was set for the data using g_task_set_task_data()). The source object and task data might not be safe to destroy on a secondary thread, though, so this is incorrect. We have to ensure they are destroyed on the task's context's thread. There are different ways we could do this, but the simplest by far is to ensure the task thread has unreffed the task before the context's thread executes the callback. And that is simple enough to do using a condition variable. We have to keep a static global map of all GTasks with outstanding task threads, which is slightly unfortunate, but we already have a bunch of global data in this file for managing the thread pool, and the map will only contain tasks that are currently running in threads, so it should be small. Fixes #1346
1 parent e10eff1
dbus-daemon.xml
<node>
<interface name="org.freedesktop.DBus">
<method name="Hello">
<arg direction="out" type="s" name="assigned_name"/>
</method>
<method name="RequestName">
<arg direction="in" type="s" name="name"/>
<arg direction="in" type="u" name="flags"/>
<arg direction="out" type="u" name="value"/>
</method>
<method name="ReleaseName">
<arg direction="in" type="s" name="name"/>
<arg direction="out" type="u" name="value"/>
</method>
<method name="StartServiceByName">
<arg direction="in" type="s" name="name"/>
<arg direction="in" type="u" name="flags"/>
<arg direction="out" type="u" name="value"/>
</method>
<method name="NameHasOwner">
<arg direction="in" type="s" name="name"/>
<arg direction="out" type="b" name="has_owner"/>
</method>
<method name="ListNames">
<arg direction="out" type="as" name="names"/>
</method>
<method name="ListActivatableNames">
<arg direction="out" type="as" name="activatable_names"/>
</method>
<method name="AddMatch">
<arg direction="in" type="s" name="rule"/>
</method>
<method name="RemoveMatch">
<arg direction="in" type="s" name="rule"/>
</method>
<method name="GetNameOwner">
<arg direction="in" type="s" name="name"/>
<arg direction="out" type="s" name="unique_name"/>
</method>
<method name="ListQueuedOwners">
<arg direction="in" type="s" name="name"/>
<arg direction="out" type="as" name="queued_owners"/>
</method>
<method name="GetConnectionUnixUser">
<arg direction="in" type="s" name="name"/>
<arg direction="out" type="u" name="uid"/>
</method>
<method name="GetConnectionUnixProcessID">
<arg direction="in" type="s" name="name"/>
<arg direction="out" type="u" name="pid"/>
</method>
<method name="GetConnectionSELinuxSecurityContext">
<arg direction="in" type="s" name="name"/>
<arg direction="out" type="ay" name="security_context"/>
</method>
<method name="UpdateActivationEnvironment">
<arg direction="in" type="a{ss}" name="environment"/>
</method>
<method name="ReloadConfig">
</method>
<method name="GetId">
<arg direction="out" type="s" name="unique_id"/>
</method>
<signal name="NameOwnerChanged">
<arg type="s" name="name"/>
<arg type="s" name="old_owner"/>
<arg type="s" name="new_owner"/>
</signal>
<signal name="NameLost">
<arg type="s" name="name"/>
</signal>
<signal name="NameAcquired">
<arg type="s" name="name"/>
</signal>
</interface>
</node>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...