properly shut down and unref nm mainloop, fixes crash at shutdown

This commit is contained in:
Martin Willi
2009-06-09 15:13:10 +02:00
parent 4d8ddefb78
commit 260158e53e
+5 -3
View File
@@ -63,8 +63,6 @@ static job_requeue_t run(private_nm_plugin_t *this)
{ {
this->loop = g_main_loop_new(NULL, FALSE); this->loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(this->loop); g_main_loop_run(this->loop);
g_main_loop_unref(this->loop);
return JOB_REQUEUE_NONE; return JOB_REQUEUE_NONE;
} }
@@ -75,7 +73,11 @@ static void destroy(private_nm_plugin_t *this)
{ {
if (this->loop) if (this->loop)
{ {
g_main_loop_quit(this->loop); if (g_main_loop_is_running(this->loop))
{
g_main_loop_quit(this->loop);
}
g_main_loop_unref(this->loop);
} }
if (this->plugin) if (this->plugin)
{ {