From: Kaj-Michael Lang Date: Wed, 9 Apr 2008 13:39:25 +0000 (+0300) Subject: Small changes to db reconnect X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76c6ea5ecb3e76aa0469110ec6f4ddf9833e18a6;p=mapper Small changes to db reconnect --- diff --git a/src/settings-gui.c b/src/settings-gui.c index 12fcd58..37ef52c 100644 --- a/src/settings-gui.c +++ b/src/settings-gui.c @@ -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();