From fe5de8f009b1ff0685bf74fe902ba40eac002d72 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 14 Mar 2021 23:06:44 +0400 Subject: [PATCH] Fix non-working UniqueConnection in gtk file dialog --- .../SourceFiles/platform/linux/linux_gtk_file_dialog.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/linux_gtk_file_dialog.cpp b/Telegram/SourceFiles/platform/linux/linux_gtk_file_dialog.cpp index 2648e9057a..7228a25279 100644 --- a/Telegram/SourceFiles/platform/linux/linux_gtk_file_dialog.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_gtk_file_dialog.cpp @@ -147,6 +147,8 @@ private: rpl::event_stream<> _accept; rpl::event_stream<> _reject; + bool _destroyedConnected = false; + }; class GtkFileDialog : public QDialog { @@ -261,8 +263,9 @@ void QGtkDialog::exec() { } void QGtkDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) { - connect(parent, &QWindow::destroyed, this, [=] { onParentWindowDestroyed(); }, - Qt::UniqueConnection); + if (!std::exchange(_destroyedConnected, true)) { + connect(parent, &QWindow::destroyed, this, [=] { onParentWindowDestroyed(); }); + } setParent(parent); setFlags(flags); setModality(modality);