From 0261c780976d8ac650006916dcc2688582f4922e Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 18 Apr 2025 02:06:40 +0200 Subject: fix: issues found by testing --- src/ui/GpgFrontendUIInit.cpp | 4 ++-- src/ui/widgets/TextEdit.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index 1ee59d12..55d934bd 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -217,7 +217,8 @@ void WaitingAllInitializationFinished() { auto RunGpgFrontendUI(QApplication* app) -> int { // create main window and show it - auto* main_window = new GpgFrontend::UI::MainWindow(); + auto main_window = QSharedPointer::create(); + main_window->setAttribute(Qt::WA_DeleteOnClose, false); // pre-check, if application need to restart if (CommonUtils::GetInstance()->IsApplicationNeedRestart()) { @@ -233,7 +234,6 @@ auto RunGpgFrontendUI(QApplication* app) -> int { // show main windows main_window->show(); - // start the main event loop return QApplication::exec(); } diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp index 5cb5d269..4f0fdd6f 100644 --- a/src/ui/widgets/TextEdit.cpp +++ b/src/ui/widgets/TextEdit.cpp @@ -75,9 +75,10 @@ void TextEdit::SlotNewDefaultFileBrowserTab() { void TextEdit::SlotNewFileBrowserTab() { auto const target_path = - QFileDialog::getOpenFileUrl(this, tr("Open File"), QDir::home().path()); + QFileDialog::getOpenFileName(this, tr("Open File"), QDir::home().path()); + if (target_path.isEmpty()) return; - tab_widget_->SlotOpenPath(target_path.path()); + tab_widget_->SlotOpenPath(target_path); } void TextEdit::SlotNewFileBrowserTabWithDirectory() { -- cgit v1.2.3