[Resolved]Application in Debug mode and Release mode
-
Hello everyone, why my application ran on debug mode is successful, but when I tried to ran on release mode, my application would be in a deadlock on somewhere of my application.My operation system is Win 7 and QT tool kit is "MinGW4.8".Could someone help me, thanks~~~~
-
Could you please provide details about you application? Which version of Qt are you using?
-
My application seems to be stopped on one of my thread that was emitting signal to my host thread that could show something on GUI, the version of my Qt is 5.1.0.And I also found my application is not crashed, because GUI still could respond to my operation.
-
Could you please share the code of the signal and the slot that handles it? Are you sure that the apps work successfully in the same scenario in debug mode?
-
Yes, I absolutely confirm. Following is my a part of code.The thread is locked here.
@
for(int j =0; j < InverterInfoList.length(); j ++)
{
emit ChangeCurrentState(QString("%1").arg(j));
if(InverterInfoList[j].isFinded == true && j == InverterInfoList[j].ModbusAddress)
{
jumpThisTime = true;
break;
}
}
@
I found what's wrong with my code.If i didn't initialize my variable, in the debug mode all things are fine, but in release mode, when you use this variable, the thread would be locked.
@
bool jumpThisTime;
@if I change my code to following
@
bool jumpThisTime = false;
@In the release mode, all things will be ok.Is this a correct behavior??
-
[quote author="Ivan1120" date="1379299915"]
In the release mode, all things will be ok.Is this a correct behavior??
[/quote]It is mandatory to initialize all variable because otherwise the behavior of the code is unexpected.
I can not say whether everything will be OK with your app because I am not familiar with it's logic and all of the code :) You have to carefully test the app :)
-
Thanks for reply : ). I'll be careful with testing the app.