On Wednesday 08 June 2016 00:58:33 Jonathan Schultz wrote: > Sorry for cross-posting, but kde-frameworks-devel seems to be a > more active list than kde-devel where I previously raised this > issue. > > I'd like to file a bug report for kdelibs4support/kio/kfiledialog > but don't seem to be able to find a relevant category in KDE > Bugzilla. If someone can point me in the right direction I'll go
https://bugs.kde.org/component-report.cgi?product=frameworks-kdelibs4support > ahead with that. In the meantime, here is a description of the > bug: > > In short, some functions do not check whether d->native is non-null > before calling a method belonging to the file chooser widget d->w. > However, d->w is only set if d->native is null, so if this is not > the case then the application crashes. This issue manifested on a > windows build of kf5/okular by the application crashing in > KFileDialog::setMimeFilter when the user attempts to opena file. > However, I see that there are another half-dozen or so functions > that have the same problem. > > In any case I made the following patch and confirmed that with it > okular > > can open files without crashing: > > --- a/src/kio/kfiledialog.cpp > > +++ b/src/kio/kfiledialog.cpp > > @@ -326,8 +326,6 @@ QString KFileDialog::currentFilter() const > > > > void KFileDialog::setMimeFilter(const QStringList &mimeTypes, > > > > const QString &defaultType) > > > > { > > > > - d->w->setMimeFilter(mimeTypes, defaultType); > > - > > > > if (d->native) { > > > > QString allExtensions; > > QStringList filters = mime2KdeFilter(mimeTypes, > > &allExtensions); > > > > @@ -336,6 +334,8 @@ void KFileDialog::setMimeFilter(const > > QStringList > > &mimeTypes, > > > } > > d->native->filter = filters.join(QLatin1String("\n")); > > > > } > > > > + else > > + d->w->setMimeFilter(mimeTypes, defaultType); > > > > } > > Presumably all the other functions that do not currently test > d->native should be made to do so. The patch looks good, but the formatting should be if (d->native) { ... d->native->filter = } else { d->w->setMimeFilter(... } I suggest to add it to https://git.reviewboard.kde.org/ so it does not get lost. Alternatively, add it to the bug report. > Cheers, > Jonathan > _______________________________________________ > Kde-frameworks-devel mailing list > Kde-frameworks-devel@kde.org > https://mail.kde.org/mailman/listinfo/kde-frameworks-devel _______________________________________________ Kde-frameworks-devel mailing list Kde-frameworks-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-frameworks-devel