]> err.no Git - mapper/commitdiff
Small changes to db reconnect
authorKaj-Michael Lang <milang@tal.org>
Wed, 9 Apr 2008 13:39:25 +0000 (16:39 +0300)
committerKaj-Michael Lang <milang@tal.org>
Wed, 9 Apr 2008 13:39:25 +0000 (16:39 +0300)
src/settings-gui.c

index 12fcd58b31bc858fe50b277c782f1890257df7c4..37ef52cb43581b95de1f04df4199ddab5b84bfd7 100644 (file)
@@ -441,18 +441,19 @@ return rcvr_changed;
 static void
 reinit_database(gchar *newdb)
 {
-if (_mapper_db)
-       g_free(_mapper_db);
-_mapper_db=newdb;
-
-if (_db || newdb==NULL) {
+if (_db) {
        poi_deinit(_db);
        osm_deinit();
        db_close(&_db);
        _db=NULL;
-       if (newdb==NULL)
-               return;
 }
+if (_mapper_db) {
+       g_free(_mapper_db);
+       _mapper_db=NULL;
+}
+_mapper_db=newdb;
+if (_mapper_db==NULL)
+       return;
 db_connect(&_db, _mapper_db);
 poi_init(&_db);
 osm_init(&_db);
@@ -515,7 +516,6 @@ if (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) {
                        reinit_database(tmp);
                }
        } else {
-               _mapper_db=NULL;
                reinit_database(NULL);
        }
        config_save();