mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
gdbusconnection: Fix race between subtree method call and unregistration
Fix another variant of the previous commit, this time specific to the idle callback of a method call on a subtree object, racing with unregistration of that subtree. In this case, the `process_subtree_vtable_message_in_idle_cb()` idle callback already has a pointer to the right `ExportedSubtree` struct, but again doesn’t have a strong reference to it. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #2400
This commit is contained in:
parent
50fbf05d61
commit
117b748e44
@ -6824,14 +6824,15 @@ handle_subtree_method_invocation (GDBusConnection *connection,
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GDBusMessage *message;
|
GDBusMessage *message; /* (owned) */
|
||||||
ExportedSubtree *es;
|
ExportedSubtree *es; /* (owned) */
|
||||||
} SubtreeDeferredData;
|
} SubtreeDeferredData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
subtree_deferred_data_free (SubtreeDeferredData *data)
|
subtree_deferred_data_free (SubtreeDeferredData *data)
|
||||||
{
|
{
|
||||||
g_object_unref (data->message);
|
g_object_unref (data->message);
|
||||||
|
exported_subtree_unref (data->es);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6890,7 +6891,7 @@ subtree_message_func (GDBusConnection *connection,
|
|||||||
|
|
||||||
data = g_new0 (SubtreeDeferredData, 1);
|
data = g_new0 (SubtreeDeferredData, 1);
|
||||||
data->message = g_object_ref (message);
|
data->message = g_object_ref (message);
|
||||||
data->es = es;
|
data->es = exported_subtree_ref (es);
|
||||||
|
|
||||||
/* defer this call to an idle handler in the right thread */
|
/* defer this call to an idle handler in the right thread */
|
||||||
idle_source = g_idle_source_new ();
|
idle_source = g_idle_source_new ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user