Kaydet (Commit) 68b15aee authored tarafından Michael Weghorn's avatar Michael Weghorn Kaydeden (comit) Katarina Behrens

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: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst 42da02bd
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment