Bug in kdelibs4support/kio/kfiledialog

Jonathan Schultz jonathan at imatix.com
Tue Jun 7 22:58:33 UTC 2016


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 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.

Cheers,
Jonathan


More information about the Kde-frameworks-devel mailing list