QT exec() command crash

房东的猫 提交于 2019-12-11 22:01:30

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/31548664/qt-exec-command-crash

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!