no args for gtk_init
[psensor.git] / src / main.c
index 5ee6c96..b28333c 100644 (file)
@@ -336,7 +336,7 @@ int main(int argc, char **argv)
        gdk_threads_init();
        /* gdk_threads_enter(); */
 
-       gtk_init(&argc, &argv);
+       gtk_init(NULL, NULL);
 
 #ifdef HAVE_LIBNOTIFY
        ui.notification_last_time = NULL;
@@ -405,9 +405,9 @@ int main(int argc, char **argv)
        /* main loop */
        gtk_main();
 
-       psensor_cleanup();
+       g_mutex_lock(ui.sensors_mutex);
 
-       psensor_list_free(ui.sensors);
+       psensor_cleanup();
 
 #ifdef HAVE_NVIDIA
        nvidia_cleanup();
@@ -415,5 +415,11 @@ int main(int argc, char **argv)
 #ifdef HAVE_LIBATIADL
        amd_cleanup();
 #endif
+
+       psensor_list_free(ui.sensors);
+       ui.sensors = NULL;
+
+       g_mutex_unlock(ui.sensors_mutex);
+
        return 0;
 }