PDA

View Full Version : Standalone executable crashing while executing using QProcess but works manually



dynesh87
3rd February 2016, 10:01
I have a console application executable which takes a file as input and prints another file as output.
This executable is used in my GUI application using QProcess::execute("MyApp.exe") command.

It has been working fine long since but for certain cases the executable crashes. I initially thought that my input might be wrong and tried to debug. But I found that the same executable is working fine when I execute it manually or use the system command.
system("MyApp.exe")

But it repeatedly crashes while executing it with QProcess::execute.

Could it be any memory leak problem while using QProcess or any limitations of QProcess.

Kindly help to resolve this issue.

Thanks in advance for your solutions

anda_skoa
3rd February 2016, 12:17
Since you are using execute(), which means you are giving up control on the child process, maybe you are doing things like deleting either file while the program is still running?
Or you are calling it again while it is still running?

Cheers,
_

d_stranz
3rd February 2016, 16:46
Or are there shared library / DLL dependencies that are successfully resolved when running from the command line or when the exe is invoked using the system() command, but which are not found when using a QProcess? In other words, is the environment the same in each scenario?

dynesh87
4th February 2016, 06:23
Or are there shared library / DLL dependencies that are successfully resolved when running from the command line or when the exe is invoked using the system() command, but which are not found when using a QProcess? In other words, is the environment the same in each scenario?

Thank you for your Reply.

We have checked the dependencies for external executable which we are running through QProcess and we did not find any problem there.

with regards,
Dinesh

Added after 4 minutes:

Thank you for reply Anda.

We will check this out.

Does the execute function wait until the console application completes its process?

with regards,
Dinesh

anda_skoa
4th February 2016, 09:39
Does the execute function wait until the console application completes its process?

Hmm, true, it does.

Do you get any backtrace for the child process?
E.g. a dumped core on Linux?
Or in other words, how did you determine that it crashed?

Cheers,
_

dynesh87
4th February 2016, 13:16
Hmm, true, it does.

Do you get any backtrace for the child process?
E.g. a dumped core on Linux?
Or in other words, how did you determine that it crashed?

Cheers,
_

Thanks for your reply Anda.

The executable was working fine in linux. It was crashing in windows(The windows showing message that the application stopped working). And in the process I found the problem. The executable was compiled in windows server and the GUI was installed in windows 7 OS. When the same GUI-executable combo was run in the server it was not crashing but in windows 7 it was crashing. And I made the executable as compatible to windows XP style in the properties in windows 7. It solved the problem. Now all my cases are working fine.

Thank you all for your valuable time and suggestions.

with regards,
Dinesh