Calling KFileDialog::setMimeFilter while using native widgets (for example on a Windows build) causes an immediate crash. Reproducible: Always Steps to Reproduce: 1.Start okular/kf5 for Windows 2.Select 'Open File' Actual Results: Application crashes Expected Results: The file chooser dialog appears The coding error is obvious. Rather than calling d->w->setMimeFilter unconditionally, it should only do so if d->native is null. While some methods in KFileDialog test d->native correctly, a number of them do not: KFileDialog::setMimeFilter KFileDialog::sizeHint KFileDialog::setConfirmOverwrite KFileDialog::okButton KFileDialog::cancelButton KFileDialog::locationEdit KFileDialog::filterWidget KFileDialog::actionCollection KFileDialog::toolBar KFileDialog::fileWidget
Created attachment 99542 [details] This patch implements the tests required to avoid hitting the bug. Some of the tests in the patch may be superfluous because the function can never be called when native widgets are used.
Heya, Jonathan. Could you upload that patch to Phabricator so it gets proper review? See https://community.kde.org/Get_Involved/development#Submitting_your_first_patch for more hints.
No problems Kevin. I had a go but got a bit stumped when Phabricator asked me to nominate a repository. I had a look at the suggested ones but none seemed looked right, and the instructions weren't much help either. Could you point me in the right direction? Thanks!
Unfortunately kdelibs4support.git has not been imported into Phab yet; this is all in the flux. You can leave the repository field empty afaik.
OK I've done it here: https://phabricator.kde.org/D2075 The patch still needs reviewers.
Git commit 1ba106517481213f116bfa5115dfe4d053176c17 by Albert Astals Cid, on behalf of Jonathan Schultz. Committed on 26/02/2017 at 23:53. Pushed by aacid into branch 'master'. Fix bug in kfiledialog.cpp that causes crashing when native widgets are used. This patch makes kfiledialog functions that did not already do so test the value of d->native before referencing d->w. This is important because if d->native is non-null then d->w will be null and referencing it cause an immediate crash. This was the case on Windows builds of okular when the file chooser was opened. Differential Revision: https://phabricator.kde.org/D2075 M +66 -56 src/kio/kfiledialog.cpp https://commits.kde.org/kdelibs4support/1ba106517481213f116bfa5115dfe4d053176c17