Fix possible error when adding to database

This commit is contained in:
zvon 2020-01-17 20:54:26 +01:00
parent dac1ccc6c4
commit fda181edea
6 changed files with 13 additions and 13 deletions

View File

@ -137,7 +137,7 @@ void DatabaseWindow::save() {
auto *pw = new ProgressWindow; auto *pw = new ProgressWindow;
app->add_window( *pw ); app->add_window( *pw );
t = std::thread( refreshSelectDB, std::ref( changed_rows ), linux, pw ); t = std::thread( refreshSelectDB, changed_rows, linux, pw );
t.detach(); t.detach();
// lambda capture // lambda capture

View File

@ -434,12 +434,12 @@ void prepareDB( const string &_pattern ) {
} }
#ifndef GUI #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 ) { bool linux, bool dvd ) {
if ( !FSLib::exists( getDBName() ) ) if ( !FSLib::exists( getDBName() ) )
prepareDB(); prepareDB();
#else #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, const string &id, const string &pattern, bool linux, bool dvd,
void *progress_ptr ) { void *progress_ptr ) {
if ( !FSLib::exists( getDBName() ) ) if ( !FSLib::exists( getDBName() ) )
@ -834,7 +834,7 @@ void changeDB( size_t index, const string &path, const string &language,
} }
#ifdef GUI #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 ) { void *progress_ptr ) {
if ( !FSLib::exists( getDBName() ) ) if ( !FSLib::exists( getDBName() ) )
return; return;

View File

@ -43,10 +43,10 @@ string userHome();
void prepareDB( const string &_pattern = TEXT( "" ) ); void prepareDB( const string &_pattern = TEXT( "" ) );
#ifndef GUI #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 ); bool linux, bool dvd );
#else #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, const string &id, const string &pattern, bool linux, bool dvd,
void *progress_ptr ); void *progress_ptr );
std::vector< std::unordered_map< std::string, std::string > > dbGetShows(); 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, void changeDB( size_t index, const string &path, const string &language,
const string &id, bool dvd ); const string &id, bool dvd );
#ifdef GUI #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 ); void *progress_ptr );
#endif #endif

View File

@ -568,8 +568,8 @@ void MainWindow::dbAdd() {
delete pw; delete pw;
} ); } );
std::thread t( addToDB, std::ref( show ), m_entry_dir->get_text(), std::thread t( addToDB, std::move( show ), m_entry_dir->get_text(),
std::ref( language_code ), std::ref( show_id ), std::move( language_code ), std::move( show_id ),
m_entry_pattern->get_text(), !m_check_linux->get_active(), m_entry_pattern->get_text(), !m_check_linux->get_active(),
m_check_dvd->get_active(), pw ); m_check_dvd->get_active(), pw );
t.detach(); t.detach();

View File

@ -280,7 +280,7 @@ bool authenticate( const std::string &api_key ) {
return true; 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 string &language, const string &pattern,
const bool &linux, const bool &trust, const bool &linux, const bool &trust,
std::map< int, string > *files_ptr, bool print, bool dvd ) { 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 string &language, const string &pattern,
const size_t &flags, std::map< int, string > *files_ptr, const size_t &flags, std::map< int, string > *files_ptr,
bool print ) { bool print ) {

View File

@ -25,13 +25,13 @@ using char_t = char;
#endif #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 string &language, const string &pattern,
const bool &linux, const bool &trust, const bool &linux, const bool &trust,
std::map< int, string > *files_ptr = nullptr, std::map< int, string > *files_ptr = nullptr,
bool print = true, bool dvd = false ); 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 string &language, const string &pattern,
const size_t &flags, const size_t &flags,
std::map< int, string > *files_ptr = nullptr, std::map< int, string > *files_ptr = nullptr,