From: Debarshi Ray <debarshir@xxxxxxxxx> Even though g_main_loop_new accepts a is_running parameter, it isn't very important since g_main_loop_run will set it to TRUE anyway. There is no requirement that it should be set before calling g_main_loop_run. The vast majority of GMainLoop users simply ignore the is_running parameter unless they are doing something out of the ordinary. --- osinfo/osinfo_install_script.c | 15 ++++++--------- osinfo/osinfo_media.c | 5 ++--- osinfo/osinfo_tree.c | 5 ++--- test/test-install-script.c | 15 ++++++--------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 92061012ba50..688c14a82e91 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -1169,7 +1169,7 @@ gchar *osinfo_install_script_generate(OsinfoInstallScript *script, GError **error) { GMainLoop *loop = g_main_loop_new(g_main_context_get_thread_default(), - TRUE); + FALSE); OsinfoInstallScriptGenerateSyncData data = { loop, NULL, NULL, NULL }; @@ -1181,8 +1181,7 @@ gchar *osinfo_install_script_generate(OsinfoInstallScript *script, osinfo_install_script_generate_done, &data); - if (g_main_loop_is_running(loop)) - g_main_loop_run(loop); + g_main_loop_run(loop); if (data.error) g_propagate_error(error, data.error); @@ -1265,7 +1264,7 @@ gchar *osinfo_install_script_generate_for_media(OsinfoInstallScript *script, GError **error) { GMainLoop *loop = g_main_loop_new(g_main_context_get_thread_default(), - TRUE); + FALSE); OsinfoInstallScriptGenerateSyncData data = { loop, NULL, NULL, NULL }; @@ -1277,8 +1276,7 @@ gchar *osinfo_install_script_generate_for_media(OsinfoInstallScript *script, osinfo_install_script_generate_for_media_done, &data); - if (g_main_loop_is_running(loop)) - g_main_loop_run(loop); + g_main_loop_run(loop); if (data.error) g_propagate_error(error, data.error); @@ -1425,7 +1423,7 @@ static GFile *osinfo_install_script_generate_output_common(OsinfoInstallScript * GError **error) { GMainLoop *loop = g_main_loop_new(g_main_context_get_thread_default(), - TRUE); + FALSE); OsinfoInstallScriptGenerateSyncData data = { loop, NULL, NULL, NULL }; @@ -1450,8 +1448,7 @@ static GFile *osinfo_install_script_generate_output_common(OsinfoInstallScript * &data); } - if (g_main_loop_is_running(loop)) - g_main_loop_run(loop); + g_main_loop_run(loop); if (data.error) g_propagate_error(error, data.error); diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c index af4bb14e3087..679e4d34ead6 100644 --- a/osinfo/osinfo_media.c +++ b/osinfo/osinfo_media.c @@ -632,7 +632,7 @@ OsinfoMedia *osinfo_media_create_from_location(const gchar *location, data = g_slice_new0(CreateFromLocationData); data->main_loop = g_main_loop_new(g_main_context_get_thread_default(), - TRUE); + FALSE); osinfo_media_create_from_location_async(location, G_PRIORITY_DEFAULT, @@ -641,8 +641,7 @@ OsinfoMedia *osinfo_media_create_from_location(const gchar *location, data); /* Loop till we get a reply (or time out) */ - if (g_main_loop_is_running(data->main_loop)) - g_main_loop_run(data->main_loop); + g_main_loop_run(data->main_loop); ret = osinfo_media_create_from_location_finish(data->res, error); create_from_location_data_free(data); diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c index 565ccfead9a6..da01c8baa444 100644 --- a/osinfo/osinfo_tree.c +++ b/osinfo/osinfo_tree.c @@ -437,7 +437,7 @@ OsinfoTree *osinfo_tree_create_from_location(const gchar *location, data = g_slice_new0(CreateFromLocationData); data->main_loop = g_main_loop_new(g_main_context_get_thread_default(), - TRUE); + FALSE); osinfo_tree_create_from_location_async(location, G_PRIORITY_DEFAULT, @@ -446,8 +446,7 @@ OsinfoTree *osinfo_tree_create_from_location(const gchar *location, data); /* Loop till we get a reply (or time out) */ - if (g_main_loop_is_running(data->main_loop)) - g_main_loop_run(data->main_loop); + g_main_loop_run(data->main_loop); ret = osinfo_tree_create_from_location_finish(data->res, error); create_from_location_data_free(data); diff --git a/test/test-install-script.c b/test/test-install-script.c index 7b16552d0720..e5e05e5f5383 100644 --- a/test/test-install-script.c +++ b/test/test-install-script.c @@ -149,7 +149,7 @@ START_TEST(test_script_file) g_object_unref(loader); loop = g_main_loop_new(g_main_context_get_thread_default(), - TRUE); + FALSE); media = create_media(); fail_unless(osinfo_db_identify_media(db, media), "Failed to identify media"); @@ -161,8 +161,7 @@ START_TEST(test_script_file) test_generate_for_media_finish, loop); - if (g_main_loop_is_running(loop)) - g_main_loop_run(loop); + g_main_loop_run(loop); unlink(BUILDDIR "/test/install-script-actual.txt"); fail_unless(error == NULL, error ? error->message : "none"); @@ -209,7 +208,7 @@ START_TEST(test_script_data) data); loop = g_main_loop_new(g_main_context_get_thread_default(), - TRUE); + FALSE); osinfo_install_script_generate_for_media_async(script, media, @@ -218,8 +217,7 @@ START_TEST(test_script_data) test_generate_for_media_finish, loop); - if (g_main_loop_is_running(loop)) - g_main_loop_run(loop); + g_main_loop_run(loop); unlink(BUILDDIR "/test/install-script-actual.txt"); fail_unless(error == NULL, error ? error->message : "none"); @@ -287,7 +285,7 @@ START_TEST(test_script_datamap) "fedora16"); loop = g_main_loop_new(g_main_context_get_thread_default(), - TRUE); + FALSE); osinfo_install_script_generate_async(script, os, @@ -296,8 +294,7 @@ START_TEST(test_script_datamap) test_generate_finish, loop); - if (g_main_loop_is_running(loop)) - g_main_loop_run(loop); + g_main_loop_run(loop); unlink(BUILDDIR "/test/install-script-actual.txt"); fail_unless(error == NULL, error ? error->message : "none"); -- 2.9.3 _______________________________________________ Libosinfo mailing list Libosinfo@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libosinfo