简体   繁体   English

QT exec()命令崩溃

[英]QT exec() command crash

I´m developing an application in QT 4.7.3. 我正在QT 4.7.3中开发应用程序。 This application is called from Matlab(simulink) using a mexFunction (*.mexw32) 使用mexFunction(* .mexw32)从Matlab(simulink)调用此应用程序

When I try to open a dialog using dialog.exec() command, the form is displayed but I get a "non responding application" instantaneously. 当我尝试使用dialog.exec()命令打开对话框时,将显示该表单,但我会立即得到“无响应的应用程序” After that, matlab crashes. 之后,matlab崩溃。

If i try to open the dialog using dialog.show() command, it works fine. 如果我尝试使用dialog.show()命令打开对话框,则效果很好。

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. dialog.exec()旋转一个本地事件循环,该循环与Matlab自身正在旋转的循环没有很好的集成。 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. 相反,只要Matlab自己的事件循环与Qt的要求兼容,您就可以做正确的事情。 This doesn't hold on all platforms, unfortunately, although on Windows it seems to work. 不幸的是,这并不适用于所有平台,尽管在Windows上似乎可行。

You should never be using exec() outside of main anyway. 无论如何,您永远都不要在main之外使用exec()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM