Develop the interface with QT4.8.6 on HiSilicon 3536 chip. GUI program is a form, in the terminal with the command line to start, instructions such as XXXX-QWS, and then click on the fork close the form, the form disappears, but the terminal command line instructions do not return, with PS view found that the process did not exit. The same code is compiled using the QT library on the PC, which is normally shut down on the PC, so it is speculated that this problem is related to QWS. By debugging the main function, it is found that the process is stuck in the destructor of Qapplication. The project for this program is created with Qt Creator, and the default main function is as follows:
int main (int argc, char *argv[])
{
Qapplication A (argc, argv);
MainWindow W;
W.show ();
return A.exec ();
}
This qapplication instance is declared as a local variable, to be destructor when the main function releases the stack, and the reason for the suspected card death is that some QWS related resources have a problem with the release order. So I use the dynamic allocation method to generate Qapplication instances, and modify the code as follows:
int main (int argc, char *argv[])
{
Qapplication *p = qapplication (argc, argv);
if (!p)
{
return-1;
}
MainWindow W;
W.show ();
int ret;
ret = P->exec ();
Delete p;
return ret;
}