Application crashed in a QT slot
I am using QT4 together with WT3.1.9.
I connected a QProcess's finished signal to a QT slot,in that slot , I insert some lines into a WTable, and the application crashed at the insertion line:
Later I'll attache a complete example project here.
Does it have anything to do with some kind of "conflict" between Wt and QT?How should I find the cause of the crash?
RE: Application crashed in a QT slot - Added by 太极美术工程狮 狮长 about 6 years ago
This is the complete project that crashed at the insertion line.
WtWithQtTest.zip - A complete qt project that crashed at the insertion line. (15.4 KB)
RE: Application crashed in a QT slot - Added by Wim Dumon about 6 years ago
Since your callback runs asynchronously, you have to grab the WApplication lock before you can modify the widget tree. Grabbing the application lock will also bind the application to the current thread (WApplication::attachThread()), which is probably the direct cause of your crash.
RE: Application crashed in a QT slot - Added by Juan Pablo Zuluaga 7 months ago
Hi 太极美术工程狮 狮长 and Wim
I`m trying to do the same as you do. do you have an example to grab the application lock using attachedThread() ? I`m trying to use Process but I never get the slot when I call readyReadStandarOutput() Signal From QProcess into my Wt Application.
Thank you !!
RE: Application crashed in a QT slot - Added by Wim Dumon 7 months ago
See examples/feature/serverpush in the Wt source code. Note that these days, we promote the user of WServer::post() as an easier alternative to grabbing the update lock.