Two qprocess using the same variable
-
wrote on 21 Aug 2013, 18:21 last edited by
Hello,
Can anyone tell me why this code stops the first bash shell??
@int main(int argc, char* argv[]) {
QApplication app(argc, argv);
app.setApplicationName("QonsoleKeyEvents");
app.setOrganizationName("objectlearning.net");
QProcess* aProcess = new QProcess();
aProcess->start("bash", QStringList("-i"), QIODevice::ReadWrite);
aProcess = new QProcess();
aProcess->start("bash", QStringList("-i"), QIODevice::ReadWrite);
return app.exec();
}
@What would be the proper way to save references to multiple qprocess??
Thanks.
-
Hi,
What do you mean by "stops the first bash shell" ?
Use one variable per QProcess
You also have a double memory leak. You don't delete your two QProcess and you lose the address of the first.
-
wrote on 21 Aug 2013, 23:34 last edited by
I mean that when you execute this code you get the following:
bq. [1]+ Stopped
I did it on purpose, I only wanted to know if the first process was stopped.
I don't get why this happens.
Any idea? -
How do you get this message ?
-
wrote on 24 Aug 2013, 11:05 last edited by
The problem only happens if the binary is executed from the terminal. I'm not sure why this happens.
-
Are you sure that the Stopped is about the bash session started with QProcess ?
-
wrote on 25 Aug 2013, 12:30 last edited by
I think so. Anyway, I executed it from dolphin and works flawlessly.
-
So if you consider this solved, could you update the thread title ?
Don't forget to clean your code of the memory leaks
-
wrote on 30 Aug 2013, 01:05 last edited by
I don't think I must mark it as solved because I don't know the real cause.
1/9