tdf#123077 gtk3_kde5: Set KFileWidget's custom widget only once
authorMichael Weghorn <m.weghorn@posteo.de>
Thu, 31 Jan 2019 08:52:51 +0000 (09:52 +0100)
committerRene Engelhard <rene@debian.org>
Thu, 31 Oct 2019 17:26:41 +0000 (17:26 +0000)
Since the event filter is only used to set the custom
widget in the KFileWidget, it can and needs to be removed
again once this has been done; which also avoids crashes.

(s. https://gerrit.libreoffice.org/#/c/67185/ for more
infos, where the same thing is done for kde5)

Change-Id: I5c719fb17510916b4730ed5c00bb638df2f183e3
Reviewed-on: https://gerrit.libreoffice.org/67184
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 30cc54a4532a732a0cf6dfe9943521978ff7292f)
Reviewed-on: https://gerrit.libreoffice.org/67204
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Gbp-Pq: Name tdf123077.diff

vcl/unx/gtk3_kde5/kde5_filepicker.cxx

index 42e278aa3d0ef6a0264e462925b2fbcf94ecb529..804aaa67e66a3deef3ccad783376f4ddde628438 100644 (file)
@@ -241,7 +241,11 @@ bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e)
         {
             KWindowSystem::setMainWindow(w, _winId);
             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);