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 );
t = std::thread( refreshSelectDB, std::ref( changed_rows ), linux, pw );
// lambda capture
auto app_ptr = app;
auto *thread = &t;
t.detach();
pw->signal_hide().connect( [pw, app_ptr, thread]() {
// lambda capture
auto *app_ptr = app.get();
pw->signal_hide().connect( [pw, app_ptr]() {
cleanDB();
app_ptr->remove_window( *pw );
thread->join();
delete pw;
} );

View File

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