[Libreoffice-commits] core.git: vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 31 10:52:39 UTC 2019


 vcl/unx/kde5/KDE5FilePicker2.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 68b15aee96abf5cd2179009424ab6a0229b67756
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Thu Jan 31 09:43:56 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Thu Jan 31 11:52:11 2019 +0100

    tdf#123077 kde5: Set KFileWidget's custom widget only once
    
    Since the event filter is only used to set the custom
    widget in the KFileWidget, it can be removed again
    once this has been done.
    
    Previously, events could cause 'fileWidget->setCustomWidget()'
    to be called multiple times, which resulted in a crash.
    (The fact that calling 'KfileWidget::setCustomWidget()'
    multiple times causes a crash could also be easily be
    reproduced by just duplicating the call.)
    
    Basically the same will be done for the gtk3_kde5 case,
    but in a separate commit to simplify backporting.
    
    Change-Id: Ic463c44d8a95f44ce09924893d682f402ad7ed3d
    Reviewed-on: https://gerrit.libreoffice.org/67185
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx
index 15725d9e075c..848dfca8ad5a 100644
--- a/vcl/unx/kde5/KDE5FilePicker2.cxx
+++ b/vcl/unx/kde5/KDE5FilePicker2.cxx
@@ -154,6 +154,7 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode)
     connect(this, &KDE5FilePicker::getFilesSignal, this, &KDE5FilePicker::getFiles,
             Qt::BlockingQueuedConnection);
 
+    // used to set the custom controls
     qApp->installEventFilter(this);
 }
 
@@ -855,7 +856,11 @@ bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e)
         if (!w->parentWidget() && w->isModal())
         {
             if (auto* fileWidget = w->findChild<KFileWidget*>({}, Qt::FindDirectChildrenOnly))
+            {
                 fileWidget->setCustomWidget(_extraControls);
+                // remove event filter again; the only purpose was to set the custom widget here
+                qApp->removeEventFilter(this);
+            }
         }
     }
     return QObject::eventFilter(o, e);


More information about the Libreoffice-commits mailing list