问题
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