=== modified file 'cpp_sqlitepp.cpp' --- cpp_sqlitepp.cpp 2007-12-28 17:13:38 +0000 +++ cpp_sqlitepp.cpp 2007-12-28 21:34:05 +0000 @@ -231,6 +231,7 @@ SQLDatabase::SQLDatabase(char const *filename) : query_ris_(0) { + pthread_mutex_init(&query_mutex, NULL); sqlite3_open(filename, &db_); sqlite3_create_function(db_, "fuzzycmp", 3, SQLITE_UTF8, 0, fuzzy_cmp_func, 0, 0); // sqlite_function_type(db_, "fuzzycmp", SQLITE_TEXT); @@ -282,6 +283,7 @@ SQLQuery *SQLDatabase::query(char const *tablename, char const *command) { char *sqlerr; + pthread_mutex_lock(&query_mutex); query_ris_ = new SQLQuery(db_, tablename); std::string cmd = command; @@ -292,8 +294,10 @@ #endif int ris = sqlite3_exec(db_, cmd.c_str(), Callback, this, &sqlerr); + pthread_mutex_unlock(&query_mutex); if( ris != SQLITE_OK ) { std::cerr << "SQLITE ERROR: " << ris << " - " << sqlerr << std::endl; + std::cerr << "Table name was " << tablename << " and query was " << cmd << std::endl; sqlite3_free(sqlerr); delete query_ris_; query_ris_ = NULL; @@ -434,8 +438,10 @@ void SQLDatabase::close() { if (db_ != 0) { + pthread_mutex_lock(&query_mutex); sqlite3_close(db_); db_ = 0; + pthread_mutex_unlock(&query_mutex); } } === modified file 'cpp_sqlitepp.hpp' --- cpp_sqlitepp.hpp 2007-12-28 16:16:40 +0000 +++ cpp_sqlitepp.hpp 2007-12-28 21:21:50 +0000 @@ -83,6 +83,7 @@ sqlite3 *db_; static int Callback(void *pArg, int argc, char **argv, char **columnNames); static void fuzzy_cmp_func(sqlite3_context*, int, sqlite3_value**); + pthread_mutex_t query_mutex; public: SQLDatabase(char const *filename); === modified file 'plugins/feature/movie/graphical_movie.cpp' --- plugins/feature/movie/graphical_movie.cpp 2007-12-26 05:12:44 +0000 +++ plugins/feature/movie/graphical_movie.cpp 2007-12-28 22:19:09 +0000 @@ -764,7 +764,10 @@ db_mutex.leaveMutex(); - assert(!parent_id.empty()); + if(parent_id.empty()){ + sleep (5);//TODO: ok, I am not crazy, this is to gain some time so that sqlite errors have time to be printed on console + assert(!parent_id.empty()); + } string::size_type i; if ((i = cut_filename.rfind('/')) == string::npos)