This workarounds a file descriptor leak (a GMainContext leak) partly
caused by GDBusConnection. See bug #690126 for more details:
https://bugzilla.gnome.org/show_bug.cgi?id=690126
It influeces also EUserPrompter.
if (!dbus_prompter) {
g_main_context_pop_thread_default (main_context);
if (!dbus_prompter) {
g_main_context_pop_thread_default (main_context);
+
+ /* Make sure the main_context doesn't have pending operations;
+ workarounds https://bugzilla.gnome.org/show_bug.cgi?id=690126 */
+ while (g_main_context_pending (main_context))
+ g_main_context_iteration (main_context, FALSE);
+
g_main_context_unref (main_context);
g_main_context_unref (main_context);
g_dbus_error_strip_remote_error (local_error);
g_simple_async_result_take_error (simple, local_error);
return;
g_dbus_error_strip_remote_error (local_error);
g_simple_async_result_take_error (simple, local_error);
return;
async_data->response_callback, async_data);
if (!async_data->invoke (dbus_prompter, async_data, cancellable, &local_error)) {
async_data->response_callback, async_data);
if (!async_data->invoke (dbus_prompter, async_data, cancellable, &local_error)) {
+ g_signal_handler_disconnect (dbus_prompter, handler_id);
+ g_object_unref (dbus_prompter);
+
g_main_context_pop_thread_default (main_context);
g_main_context_pop_thread_default (main_context);
+
+ /* Make sure the main_context doesn't have pending operations;
+ workarounds https://bugzilla.gnome.org/show_bug.cgi?id=690126 */
+ while (g_main_context_pending (main_context))
+ g_main_context_iteration (main_context, FALSE);
+
g_main_context_unref (main_context);
g_main_context_unref (main_context);
g_dbus_error_strip_remote_error (local_error);
g_simple_async_result_take_error (simple, local_error);
g_dbus_error_strip_remote_error (local_error);
g_simple_async_result_take_error (simple, local_error);
- g_signal_handler_disconnect (dbus_prompter, handler_id);
- g_object_unref (dbus_prompter);
g_object_unref (dbus_prompter);
g_main_context_pop_thread_default (main_context);
g_object_unref (dbus_prompter);
g_main_context_pop_thread_default (main_context);
+
+ /* Make sure the main_context doesn't have pending operations;
+ workarounds https://bugzilla.gnome.org/show_bug.cgi?id=690126 */
+ while (g_main_context_pending (main_context))
+ g_main_context_iteration (main_context, FALSE);
+
g_main_context_unref (main_context);
}
g_main_context_unref (main_context);
}
exit:
g_main_context_pop_thread_default (main_context);
exit:
g_main_context_pop_thread_default (main_context);
+
+ /* Make sure the main_context doesn't have pending operations;
+ workarounds https://bugzilla.gnome.org/show_bug.cgi?id=690126 */
+ while (g_main_context_pending (main_context))
+ g_main_context_iteration (main_context, FALSE);
+
g_main_context_unref (main_context);
return success;
g_main_context_unref (main_context);
return success;