Fix crash on save in 'DatabaseManage' (and possibly other stuff that uses progresswindow)
This commit is contained in:
parent
471f1ac526
commit
586d0d90dc
@ -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;
|
||||
} );
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user