[PyQt] Segfault with QDesktopServices.openUrl
Kovid Goyal
kovid at kovidgoyal.net
Thu Aug 21 10:24:50 BST 2014
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.
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.
Kovid.
>
> Phil
>
> >On Wed, Aug 20, 2014 at 09:07:05PM +0200, Florian Bruhin wrote:
> >>Hi,
> >>
> >>I get a segfault every time I try to use QDesktopServices.openUrl.
> >>/tmp/test.txt is a simple text file.
> >>
> >>Am I doing something wrong, or is this a bug somewhere?
> >>
> >>GDB output:
> >>
> >>$ gdb /usr/bin/python
> >>...
> >>Python 3.4.1 (default, May 19 2014, 17:23:49)
> >>[GCC 4.9.0 20140507 (prerelease)] on linux
> >>Type "help", "copyright", "credits" or "license" for more information.
> >>>>> from PyQt5.QtGui import QDesktopServices
> >>>>> from PyQt5.QtCore import QUrl
> >>>>> QDesktopServices.openUrl(QUrl('file:///tmp/test.txt'))
> >>
> >>Program received signal SIGSEGV, Segmentation fault.
> >>0x00007ffff5b5a870 in QDesktopServices::openUrl(QUrl const&) () from
> >>/usr/lib/libQt5Gui.so.5
> >>(gdb) bt
> >>#0 0x00007ffff5b5a870 in QDesktopServices::openUrl(QUrl const&) () from
> >>/usr/lib/libQt5Gui.so.5
> >>#1 0x00007ffff60cb3ee in ?? () from
> >>/usr/lib/python3.4/site-packages/PyQt5/QtGui.so
> >>#2 0x00007ffff7a5dbf5 in call_function (oparg=<optimized out>,
> >>pp_stack=0x7fffffffdb50) at Python/ceval.c:4227
> >>#3 PyEval_EvalFrameEx (f=0x678998, throwflag=<optimized out>) at
> >>Python/ceval.c:2829
> >>#4 0x00007ffff7a5f289 in PyEval_EvalCodeEx (_co=0x0,
> >>_co at entry=0x7ffff7e44c00, globals=0x0, locals=0x678b10,
> >> args=0x0, argcount=24, argcount at entry=0, kws=0x2f, kws at entry=0x0,
> >>kwcount=0, defs=0x0, defcount=0,
> >> kwdefs=0x0, closure=0x0) at Python/ceval.c:3578
> >>#5 0x00007ffff7a5f32b in PyEval_EvalCode (co=co at entry=0x7ffff7e44c00,
> >>globals=globals at entry=0x7ffff7f1f548,
> >> locals=locals at entry=0x7ffff7f1f548) at Python/ceval.c:773
> >>#6 0x00007ffff7a7b4d4 in run_mod (mod=mod at entry=0x71bd38,
> >>filename=filename at entry=0x7ffff7ed7c70,
> >> globals=0x7ffff7f1f548, locals=0x7ffff7f1f548,
> >>flags=flags at entry=0x7fffffffddf0,
> >> arena=arena at entry=0x7401d0) at Python/pythonrun.c:2180
> >>#7 0x00007ffff7a7e1a2 in PyRun_InteractiveOneObject
> >>(fp=fp at entry=0x7ffff77229c0 <_IO_2_1_stdin_>,
> >> filename=filename at entry=0x7ffff7ed7c70,
> >>flags=flags at entry=0x7fffffffddf0) at Python/pythonrun.c:1445
> >>#8 0x00007ffff7a7e45e in PyRun_InteractiveLoopFlags
> >>(fp=fp at entry=0x7ffff77229c0 <_IO_2_1_stdin_>,
> >> filename_str=filename_str at entry=0x7ffff7b030d6 "<stdin>",
> >>flags=flags at entry=0x7fffffffddf0)
> >> at Python/pythonrun.c:1324
> >>#9 0x00007ffff7a7f4de in PyRun_AnyFileExFlags (fp=0x7ffff77229c0
> >><_IO_2_1_stdin_>,
> >> filename=0x7ffff7b030d6 "<stdin>", closeit=0, flags=0x7fffffffddf0)
> >>at Python/pythonrun.c:1286
> >>#10 0x00007ffff7a94751 in run_file (p_cf=<optimized out>,
> >>filename=<optimized out>, fp=<optimized out>)
> >> at Modules/main.c:319
> >>#11 Py_Main (argc=0, argv=0x0) at Modules/main.c:751
> >>#12 0x0000000000400af6 in main ()
> >>
> >>
> >>Thanks,
> >>
> >>Florian
> >>
> >>--
> >>http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
> >> GPG 0xFD55A072 | http://the-compiler.org/pubkey.asc
> >> I love long mails! | http://email.is-not-s.ms/
> >
> >
> >
> >>_______________________________________________
> >>PyQt mailing list PyQt at riverbankcomputing.com
> >>http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> >
> >
> >_______________________________________________
> >PyQt mailing list PyQt at riverbankcomputing.com
> >http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
> !DSPAM:3,53f5a0bb16781608116167!
>
>
--
_____________________________________
Dr. Kovid Goyal
http://www.kovidgoyal.net
http://calibre-ebook.com
_____________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140821/af811551/attachment.sig>
More information about the PyQt
mailing list