mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
subprocess: Fix communicate_cancelled signature
The source callback for a GCancellable should have the cancellable itself as first argument. This was not the case, and when this code was hit, we were instead trying to treat the pointer as a CommunicateState reference and thus wrongly deferencing it, causing a memory error and a crash.
This commit is contained in:
parent
f2504be625
commit
5cc4cca9c6
@ -1528,7 +1528,8 @@ g_subprocess_communicate_made_progress (GObject *source_object,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_subprocess_communicate_cancelled (gpointer user_data)
|
||||
g_subprocess_communicate_cancelled (GCancellable *cancellable,
|
||||
gpointer user_data)
|
||||
{
|
||||
CommunicateState *state = user_data;
|
||||
|
||||
@ -1580,7 +1581,9 @@ g_subprocess_communicate_internal (GSubprocess *subprocess,
|
||||
{
|
||||
state->cancellable_source = g_cancellable_source_new (cancellable);
|
||||
/* No ref held here, but we unref the source from state's free function */
|
||||
g_source_set_callback (state->cancellable_source, g_subprocess_communicate_cancelled, state, NULL);
|
||||
g_source_set_callback (state->cancellable_source,
|
||||
G_SOURCE_FUNC (g_subprocess_communicate_cancelled),
|
||||
state, NULL);
|
||||
g_source_attach (state->cancellable_source, g_main_context_get_thread_default ());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user