From fda181edea25cf193994ff2fcf37b5fe9bdc4210 Mon Sep 17 00:00:00 2001 From: zvon Date: Fri, 17 Jan 2020 20:54:26 +0100 Subject: [PATCH] Fix possible error when adding to database --- databasewindow.cpp | 2 +- functions.cpp | 6 +++--- functions.hpp | 6 +++--- mainwindow.cpp | 4 ++-- tv_rename.cpp | 4 ++-- tv_rename.hpp | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/databasewindow.cpp b/databasewindow.cpp index d19a31c..0f26db1 100644 --- a/databasewindow.cpp +++ b/databasewindow.cpp @@ -137,7 +137,7 @@ void DatabaseWindow::save() { auto *pw = new ProgressWindow; app->add_window( *pw ); - t = std::thread( refreshSelectDB, std::ref( changed_rows ), linux, pw ); + t = std::thread( refreshSelectDB, changed_rows, linux, pw ); t.detach(); // lambda capture diff --git a/functions.cpp b/functions.cpp index 443148c..b0b3378 100644 --- a/functions.cpp +++ b/functions.cpp @@ -434,12 +434,12 @@ void prepareDB( const string &_pattern ) { } #ifndef GUI -void addToDB( string &show, const string &path, const string &language, +void addToDB( const string &show, const string &path, const string &language, bool linux, bool dvd ) { if ( !FSLib::exists( getDBName() ) ) prepareDB(); #else -void addToDB( string &show, const string &path, const string &language, +void addToDB( const string &show, const string &path, const string &language, const string &id, const string &pattern, bool linux, bool dvd, void *progress_ptr ) { if ( !FSLib::exists( getDBName() ) ) @@ -834,7 +834,7 @@ void changeDB( size_t index, const string &path, const string &language, } #ifdef GUI -void refreshSelectDB( std::unordered_set< size_t > &indexes, bool linux, +void refreshSelectDB( std::unordered_set< size_t > indexes, bool linux, void *progress_ptr ) { if ( !FSLib::exists( getDBName() ) ) return; diff --git a/functions.hpp b/functions.hpp index e68a85c..9b30f4a 100644 --- a/functions.hpp +++ b/functions.hpp @@ -43,10 +43,10 @@ string userHome(); void prepareDB( const string &_pattern = TEXT( "" ) ); #ifndef GUI -void addToDB( string &show, const string &path, const string &language, +void addToDB( const string &show, const string &path, const string &language, bool linux, bool dvd ); #else -void addToDB( string &show, const string &path, const string &language, +void addToDB( const string &show, const string &path, const string &language, const string &id, const string &pattern, bool linux, bool dvd, void *progress_ptr ); std::vector< std::unordered_map< std::string, std::string > > dbGetShows(); @@ -67,7 +67,7 @@ void cleanDB(); void changeDB( size_t index, const string &path, const string &language, const string &id, bool dvd ); #ifdef GUI -void refreshSelectDB( std::unordered_set< size_t > &indexes, bool linux, +void refreshSelectDB( std::unordered_set< size_t > indexes, bool linux, void *progress_ptr ); #endif diff --git a/mainwindow.cpp b/mainwindow.cpp index 8139e4c..5148184 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -568,8 +568,8 @@ void MainWindow::dbAdd() { delete pw; } ); - std::thread t( addToDB, std::ref( show ), m_entry_dir->get_text(), - std::ref( language_code ), std::ref( show_id ), + std::thread t( addToDB, std::move( show ), m_entry_dir->get_text(), + std::move( language_code ), std::move( show_id ), m_entry_pattern->get_text(), !m_check_linux->get_active(), m_check_dvd->get_active(), pw ); t.detach(); diff --git a/tv_rename.cpp b/tv_rename.cpp index 381479b..b4921f4 100644 --- a/tv_rename.cpp +++ b/tv_rename.cpp @@ -280,7 +280,7 @@ bool authenticate( const std::string &api_key ) { return true; } -void singleSeason( const string &path, string &show, int season, string id, +void singleSeason( const string &path, const string &show, int season, string id, const string &language, const string &pattern, const bool &linux, const bool &trust, std::map< int, string > *files_ptr, bool print, bool dvd ) { @@ -344,7 +344,7 @@ end: } } -void singleSeason( const string &path, string &show, int season, string id, +void singleSeason( const string &path, const string &show, int season, string id, const string &language, const string &pattern, const size_t &flags, std::map< int, string > *files_ptr, bool print ) { diff --git a/tv_rename.hpp b/tv_rename.hpp index 927bd72..cd4e721 100644 --- a/tv_rename.hpp +++ b/tv_rename.hpp @@ -25,13 +25,13 @@ using char_t = char; #endif -void singleSeason( const string &path, string &show, int season, string id, +void singleSeason( const string &path, const string &show, int season, string id, const string &language, const string &pattern, const bool &linux, const bool &trust, std::map< int, string > *files_ptr = nullptr, bool print = true, bool dvd = false ); -void singleSeason( const string &path, string &show, int season, string id, +void singleSeason( const string &path, const string &show, int season, string id, const string &language, const string &pattern, const size_t &flags, std::map< int, string > *files_ptr = nullptr,