Skip to content

Commit a9a9227

Browse files
blairstevencarlgsmith
authored andcommitted
Stop creating default main context
g_main_context_invoke_full has a side-effect of allocating the default GMainContext if it doesn't already exist - this can appear to be a leaked file descriptor under some conditions.
1 parent aede812 commit a9a9227

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rpc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,12 @@ submit_slow_work (rpc_instance rpc, struct rpc_work_s *work, guint timeout_ms)
208208
else
209209
{
210210
/* Pass the work to the slow worker thread */
211-
g_main_context_invoke_full (rpc->slow_context, G_PRIORITY_DEFAULT, slow_callback_fn, (gpointer) work, NULL);
211+
GSource *source;
212+
source = g_idle_source_new ();
213+
g_source_set_priority (source, G_PRIORITY_DEFAULT);
214+
g_source_set_callback (source, slow_callback_fn, work, NULL);
215+
g_source_attach (source, rpc->slow_context);
216+
g_source_unref (source);
212217
}
213218
}
214219

0 commit comments

Comments
 (0)