]> git.street.me.uk Git - andy/viking.git/blobdiff - src/osm-traces.c
Merge branch 'KMZ-Maps'
[andy/viking.git] / src / osm-traces.c
index 33df22c731f9a6c06e61a999099552c0b2ddc469..7e0792bd7eac435785ea5afaae48cc5aeb965d7b 100644 (file)
@@ -127,11 +127,6 @@ static const gchar *get_default_user()
 
 void osm_set_login(const gchar *user, const gchar *password)
 {
-  /* Allocate mutex */
-  if (login_mutex == NULL)
-  {
-    login_mutex = g_mutex_new();
-  }
   g_mutex_lock(login_mutex);
   g_free(osm_user); osm_user = NULL;
   g_free(osm_password); osm_password = NULL;
@@ -160,6 +155,12 @@ void osm_traces_init () {
   tmp.s = "";
   a_preferences_register(prefs+1, tmp, VIKING_OSM_TRACES_PARAMS_GROUP_KEY);
 
+  login_mutex = vik_mutex_new();
+}
+
+void osm_traces_uninit()
+{
+  vik_mutex_free(login_mutex);
 }
 
 /*
@@ -524,14 +525,15 @@ void osm_traces_upload_viktrwlayer ( VikTrwLayer *vtl, VikTrack *trk )
 
     title = g_strdup_printf(_("Uploading %s to OSM"), info->name);
 
-    /* launch the thread */
-    a_background_thread(VIK_GTK_WINDOW_FROM_LAYER(vtl),          /* parent window */
-                       title,                                   /* description string */
-                       (vik_thr_func) osm_traces_upload_thread, /* function to call within thread */
-                       info,                                    /* pass along data */
-                       (vik_thr_free_func) oti_free,            /* function to free pass along data */
-                       (vik_thr_free_func) NULL,
-                       1 );
+    // launch the thread
+    a_background_thread( BACKGROUND_POOL_REMOTE,
+                         VIK_GTK_WINDOW_FROM_LAYER(vtl),          /* parent window */
+                         title,                                   /* description string */
+                         (vik_thr_func) osm_traces_upload_thread, /* function to call within thread */
+                         info,                                    /* pass along data */
+                         (vik_thr_free_func) oti_free,            /* function to free pass along data */
+                         (vik_thr_free_func) NULL,
+                         1 );
     g_free ( title ); title = NULL;
   }
   gtk_widget_destroy ( dia );