Moved running check to init
1 files changed, 8 insertions(+), 8 deletions(-)

M src/notify.c
M src/notify.c +8 -8
@@ 358,18 358,18 @@ static void name_lost(GDBusConnection* c
 
 static void* run(void* data) {
 	(void) data;
-	if(!running) {
-		running = true;
-		g_bus_own_name(G_BUS_TYPE_SESSION, "org.freedesktop.Notifications", G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE, NULL, name_acquired, name_lost, NULL, NULL);
-		GMainLoop* loop = g_main_loop_new(NULL, FALSE);
-		g_main_loop_run(loop);
-	}
+	g_bus_own_name(G_BUS_TYPE_SESSION, "org.freedesktop.Notifications", G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE, NULL, name_acquired, name_lost, NULL, NULL);
+	GMainLoop* loop = g_main_loop_new(NULL, FALSE);
+	g_main_loop_run(loop);
 	return NULL;
 }
 
 void libnotif_init(void) {
-	pthread_t thread;
-	pthread_create(&thread, NULL, run, NULL);
+	if(!running) {
+		running = true;
+		pthread_t thread;
+		pthread_create(&thread, NULL, run, NULL);
+	}
 }
 
 char** libnotif_get_info(void) {