From 59baba3732d3a9464b754ee5a2c8778158d638f8 Mon Sep 17 00:00:00 2001 From: VProdanov Date: Mon, 13 Jun 2016 19:15:14 +0300 Subject: Fix_core_dump_when_app_is_in_LIMITED_and_ignition_off_is_sent The reason for the coredump was a string destructor call after the string was already destructed. After checking the address in memory where we were dummped the involved strings were discovered. The apperant reason for the double destruction in doubled linking of the same string in static and dynamic library. Related-Issue: APPLINK-22355 --- .../application_manager/src/resumption/resumption_data_db.cc | 8 ++++---- src/components/policy/include/policy/sql_pt_representation.h | 1 - src/components/policy/src/sql_pt_representation.cc | 3 +-- .../utils/include/utils/sqlite_wrapper/sql_database.h | 11 ----------- src/components/utils/src/sqlite_wrapper/sql_database.cc | 6 ++++-- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc index 7e025917c4..7e546a012c 100644 --- a/src/components/application_manager/src/resumption/resumption_data_db.cc +++ b/src/components/application_manager/src/resumption/resumption_data_db.cc @@ -48,13 +48,13 @@ #include "utils/file_system.h" #include "application_manager/application_manager_settings.h" -namespace { -const std::string kDatabaseName = "resumption"; -} - namespace resumption { CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption") +namespace { +const char* kDatabaseName = "resumption"; +} // namespace + ResumptionDataDB::ResumptionDataDB( DbStorage db_storage, const application_manager::ApplicationManager& application_manager) diff --git a/src/components/policy/include/policy/sql_pt_representation.h b/src/components/policy/include/policy/sql_pt_representation.h index d8b168e9c9..2710a7d4a5 100644 --- a/src/components/policy/include/policy/sql_pt_representation.h +++ b/src/components/policy/include/policy/sql_pt_representation.h @@ -193,7 +193,6 @@ class SQLPTRepresentation : public virtual PTRepresentation { virtual bool UpdateDBVersion() const OVERRIDE; private: - static const std::string kDatabaseName; utils::dbms::SQLDatabase* db_; #ifdef BUILD_TESTS diff --git a/src/components/policy/src/sql_pt_representation.cc b/src/components/policy/src/sql_pt_representation.cc index 4e47b209e6..046b858131 100644 --- a/src/components/policy/src/sql_pt_representation.cc +++ b/src/components/policy/src/sql_pt_representation.cc @@ -66,10 +66,9 @@ void InsertUnique(K value, T* array) { array->push_back(value); } } +const char* kDatabaseName = "policy"; } // namespace -const std::string SQLPTRepresentation::kDatabaseName = "policy"; - SQLPTRepresentation::SQLPTRepresentation(const std::string& app_storage_folder, uint16_t attempts_to_open_policy_db, uint16_t open_attempt_timeout_ms) diff --git a/src/components/utils/include/utils/sqlite_wrapper/sql_database.h b/src/components/utils/include/utils/sqlite_wrapper/sql_database.h index 437cfd4920..5fd3de5fa1 100644 --- a/src/components/utils/include/utils/sqlite_wrapper/sql_database.h +++ b/src/components/utils/include/utils/sqlite_wrapper/sql_database.h @@ -148,17 +148,6 @@ class SQLDatabase { int error_; - /** - * The temporary in-memory database - * @see SQLite manual - */ - static const std::string kInMemory; - - /** - * The extension of filename of database - */ - static const std::string kExtension; - /** * Execs query for internal using in this class * @param query sql query without return results diff --git a/src/components/utils/src/sqlite_wrapper/sql_database.cc b/src/components/utils/src/sqlite_wrapper/sql_database.cc index 7b7e1f3d5a..4763ddc776 100644 --- a/src/components/utils/src/sqlite_wrapper/sql_database.cc +++ b/src/components/utils/src/sqlite_wrapper/sql_database.cc @@ -36,8 +36,10 @@ namespace utils { namespace dbms { -const std::string SQLDatabase::kInMemory = ":memory:"; -const std::string SQLDatabase::kExtension = ".sqlite"; +namespace { +const char* kInMemory = ":memory:"; +const char* kExtension = ".sqlite"; +} // namespace SQLDatabase::SQLDatabase() : conn_(NULL), database_path_(kInMemory), error_(SQLITE_OK) {} -- cgit v1.2.1