Python 3.4:Windows上的PyQt:仅在某些计算机上退出时崩溃 [英] Python 3.4: PyQt on Windows: Crash on exit only on some computers
问题描述
我有一个Python程序,我使用 cx_freeze
打包以使可执行文件。该程序严格来说是一个用于数据采集的桌面程序。它工作正常,并在每台计算机上退出很好,但我们在Windows 7上的合作者之一,在一个桌面上,它只是退出崩溃(我强调的是,没有Python的错误中给出。只是关于零信息的低级别的碰撞它)。只要开始和退出程序就会崩溃!
我让那个家伙为我创建了一个内存转储,他做了。奇怪的部分如下:创建一个内存转储和分析它与WinDbg给出以下链错误:
STACK_TEXT:
警告:堆叠展开信息不可用。以下帧可能出错。
0020f940 5c51b34e 5c7bd640 9d7a3385 03c93748 QtCore4!QHashData :: free_helper + 0×26
0020f974 76e314bd 00b30000 00000000 03e0c4c0 QtGui4!QGestureRecognizer ::复位+ 0x1f9e
0020f9a0 5c51c968 03c93748 5d3608c2 00000001 KERNEL32!HeapFree + 0×14
0020f9a8 5d3608c2 00000001 03c93748 03891250 QtGui4!QGestureRecognizer ::复位+ 0x35b8
0020f9c0 5d3627b5 9d0dae1c 03891250 03cac0a0 QtCore4!QObjectPrivate :: deleteChildren + 0x72
00000000 00000000 00000000 00000000 00000000 QtCore4!QObject的::〜QObject的+ 0x3e5
现在什么让我惊讶的是,从 QGestureRecognizer投诉
(其为 QtGUI的一部分显然的)给出!但为什么?我不使用任何触摸功能!我使用的模块是: QtCore
和 QtGUI
。这是从哪里来的?我可以,像强制禁用与该类相关的一切: QGestureRecognizer
?
此问题似乎只发生在Windows 7计算机上。它在2台电脑进行测试与Windows 7和相同的事故发生。
原来全部强>我用来与这个程序崩溃的问题是因为QThread(在Windows上)。我知道的所有用户在Windows上使用QThread有类似的问题,并且由于某种原因没有人修复它。
在Python上避免QThread。它是完全无用的,更有害的,而不是有用的。我现在去了 multiprocessing
。它更好,不受GIL影响。
I have a Python program that I packaged with cx_freeze
to make executable. The program is strictly a desktop program for data acquisition. It works fine and exits fine on every computer, but on one desktop of one of our collaborators with Windows 7 on it, it crashes only on exit (I emphasize that no pythonic errors are given. Just a low-level crash with zero information about it). Simply starting and exiting the program crashes it!
I got the guy to create a memory dump for me, and he did. The weird part is the following: Creating a memory dump out of this and analyzing it with WinDbg gives the following chain of errors:
STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be wrong.
0020f940 5c51b34e 5c7bd640 9d7a3385 03c93748 QtCore4!QHashData::free_helper+0x26
0020f974 76e314bd 00b30000 00000000 03e0c4c0 QtGui4!QGestureRecognizer::reset+0x1f9e
0020f9a0 5c51c968 03c93748 5d3608c2 00000001 kernel32!HeapFree+0x14
0020f9a8 5d3608c2 00000001 03c93748 03891250 QtGui4!QGestureRecognizer::reset+0x35b8
0020f9c0 5d3627b5 9d0dae1c 03891250 03cac0a0 QtCore4!QObjectPrivate::deleteChildren+0x72
00000000 00000000 00000000 00000000 00000000 QtCore4!QObject::~QObject+0x3e5
Now what surprises me is that a complaint from QGestureRecognizer
(which is a part of QtGUI apparently) is given! But why? I don't use any touch capabilities! The modules I use are: QtCore
and QtGUI
. Where is this coming from? Can I, like, force disable everything related to that class: QGestureRecognizer
? What would you do in this case?
Update:
This issue seems to happen ONLY on Windows 7 computers. It was tested on 2 computers with Windows 7 and the same crash happened.
It turned out that ALL the problems I used to have with this program crashing were because of QThread (on Windows). All the users I know of that used QThread on Windows got similar issues, and for some reason no one is fixing it.
Avoid QThread on Python. It's completely useless and more harmful than useful. I went now to multiprocessing
. It's much better and isn't affected by GIL.
这篇关于Python 3.4:Windows上的PyQt:仅在某些计算机上退出时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!