[DF161106-01476] Change db init / deinit time for Kona Defect. 69/96169/1 accepted/tizen/common/20161109.140427 accepted/tizen/ivi/20161110.000644 accepted/tizen/mobile/20161110.000606 accepted/tizen/tv/20161110.000622 submit/tizen/20161109.013903
authorJihoon Jung <jh8801.jung@samsung.com>
Mon, 7 Nov 2016 09:38:41 +0000 (18:38 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Tue, 8 Nov 2016 05:22:55 +0000 (14:22 +0900)
Change-Id: I4fc6c4f58301c01e8cc6d909793cbcc83a3e3cc6

src/mtp.c
src/mtp_db.c

index df9fcf9..8f84169 100755 (executable)
--- a/src/mtp.c
+++ b/src/mtp.c
@@ -94,7 +94,6 @@ int mtp_initialize(void)
 
        if (__is_initialized == false) {
                ret = mtp_gdbus_manager_initialize();
-               mtp_db_init();
                __is_initialized = true;
        }
        ref_count++;
@@ -330,7 +329,6 @@ int mtp_deinitialize(void)
                ref_count--;
 
        if (__is_initialized == true && ref_count == 0) {
-               mtp_db_deinit();
                mtp_gdbus_manager_remove_all_event_cb();
                ret = mtp_gdbus_manager_deinitialize();
                __is_initialized = false;
index c70d8c3..887acdd 100755 (executable)
@@ -57,6 +57,8 @@ mtp_error_e mtp_db_get_object_info(int mtp_device, int object_handle, mtp_object
        char *sql = NULL;
        sqlite3_stmt *stmt = NULL;
 
+       mtp_db_init();
+
        MTP_DB_LOCK;
 
        if (db == NULL) {
@@ -111,6 +113,8 @@ mtp_error_e mtp_db_get_object_info(int mtp_device, int object_handle, mtp_object
 
        MTP_DB_UNLOCK;
 
+       mtp_db_deinit();
+
        return ret;
 }
 /* LCOV_EXCL_STOP */