[PyQt] Segfault with QDesktopServices.openUrl
David Boddie
davidb at met.no
Thu Aug 21 14:42:02 BST 2014
On Thu Aug 21 10:24:50 BST 2014, Kovid Goyal wrote:
> On Thu, Aug 21, 2014 at 08:32:53AM +0100, Phil Thompson wrote:
> > On 21/08/2014 3:58 am, Kovid Goyal wrote:
> > >https://github.com/kovidgoyal/calibre/commit/796cba4b6996d2047f203ce0a0ef0637b10b33ec
> > >
> > >Kovid.
> >
> > I'm not sure it's a Qt bug. There are lots of things (often platform
> > specific) that you can't do until you have created a QApplication.
>
> It is a regression from Qt 4, when QDS::openUrl did not require a
> QApplication. Perhaps that is the intended behavior and the bug is in Qt
> 4, I wouldn't know. I do know that all QDS does on linux is call
> xdg-open, so there is no actual need to construct a QApplication.
There's some code in openUrl() that expects to find a platform integration
instance to use, which I believe only exists if you create a QApplication
instance first:
QPlatformServices *platformServices = QGuiApplicationPrivate::platformIntegration()->services();
if (!platformServices) {
qWarning("%s: The platform plugin does not support services.", Q_FUNC_INFO);
return false;
}
> Not to mention that in most other places where you try to use
> functionality from Qt that requires QApplication, you get a clean erorr
> message and a call to _exit(), not a segfault.
Please file a bug against Qt for this. At the very least, openUrl() should
check that a platform integration instance exists before checking for its
services.
David
More information about the PyQt
mailing list