From 586d0d90dc5a25e61ff3eebaae8764c7c2b64116 Mon Sep 17 00:00:00 2001 From: zvon Date: Fri, 17 Jan 2020 16:24:47 +0100 Subject: [PATCH] Fix crash on save in 'DatabaseManage' (and possibly other stuff that uses progresswindow) --- databasewindow.cpp | 10 +++++----- progress.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/databasewindow.cpp b/databasewindow.cpp index b867200..d19a31c 100644 --- a/databasewindow.cpp +++ b/databasewindow.cpp @@ -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; } ); diff --git a/progress.cpp b/progress.cpp index 7a821c1..a1ac09f 100644 --- a/progress.cpp +++ b/progress.cpp @@ -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