Fix crash on save in 'DatabaseManage' (and possibly other stuff that uses progresswindow)

This commit is contained in:
zvon 2020-01-17 16:24:47 +01:00
parent 471f1ac526
commit 586d0d90dc
2 changed files with 6 additions and 6 deletions

View File

@ -138,14 +138,14 @@ void DatabaseWindow::save() {
app->add_window( *pw ); app->add_window( *pw );
t = std::thread( refreshSelectDB, std::ref( changed_rows ), linux, pw ); t = std::thread( refreshSelectDB, std::ref( changed_rows ), linux, pw );
// lambda capture t.detach();
auto app_ptr = app;
auto *thread = &t;
pw->signal_hide().connect( [pw, app_ptr, thread]() { // lambda capture
auto *app_ptr = app.get();
pw->signal_hide().connect( [pw, app_ptr]() {
cleanDB(); cleanDB();
app_ptr->remove_window( *pw ); app_ptr->remove_window( *pw );
thread->join();
delete pw; delete pw;
} ); } );

View File

@ -114,7 +114,7 @@ void ProgressBar::print( const string &t ) {
ProgressBar::~ProgressBar() { ProgressBar::~ProgressBar() {
#ifndef _WIN32 #ifndef _WIN32
static_cast< ProgressWindow * >( ptr )->~ProgressWindow(); static_cast< ProgressWindow * >( ptr )->hide();
#else #else
PostMessageW( ptr, WM_APP, 2, 0 ); PostMessageW( ptr, WM_APP, 2, 0 );
#endif #endif