QT exec()命令崩溃 [英] QT exec() command crash
问题描述
我在QT 4.7.3中开发应用程序。当我尝试使用 dialog.exec()
打开一个对话框时,使用一个mexFunction(* .mexw32)命令,表单显示,但我立即得到无响应的应用程序。之后,matlab崩溃。
如果我尝试使用 dialog.show()命令打开对话框, >
我真的不知道发生了什么,因为这两个命令在某种程度上是类似的,因为这里描述
?
dialog.exec()
旋转本地事件循环不能很好地与Matlab本身旋转的集成。因此崩溃。相反,你正在使用Matlab做正确的事情,只要它自己的事件循环与Qt的要求兼容。这不适用于所有平台,不幸的是,虽然在Windows上它似乎工作。
你不应该使用 exec() code>
I´m developing an application in QT 4.7.3. This application is called from Matlab(simulink) using a mexFunction (*.mexw32)
When I try to open a dialog using dialog.exec() command, the form is displayed but I get a "non responding application" instantaneously. After that, matlab crashes.
If i try to open the dialog using dialog.show() command, it works fine.
I really have no idea of whats going on, since both commands are somehow similar, as described here
Does anyone know what is happening?
dialog.exec()
spins a local event loop that doesn't integrate well with the one that Matlab itself is spinning. Thus the crash. Conversely, you're banking on Matlab doing the right thing as far as its own event loop being compatible with Qt's requirements goes. This doesn't hold on all platforms, unfortunately, although on Windows it seems to work.
You should never be using exec()
outside of main
anyway.
这篇关于QT exec()命令崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!