[Qt-interest] detached QProcess

Thiago Macieira thiago.macieira at trolltech.com
Tue Jul 21 17:00:36 CEST 2009


Em Terça-feira 21 Julho 2009, às 14:32:00, Sarvesh Saran escreveu:
> Hi,
>
> I have a GUI application that starts a external binary in a QProcess.
> ..(new QProcess(this)) ...
>
> However there are cases when the external binary crashes  which in turn
> causes my GUI application to crash as well.

That means there are two bugs:
 1) one that made the sub-process crash
 2) one that made your GUI application to crash

Both should be fixed. But, in any case, QProcess doesn't cause your application 
to crash if the subprocess did. It has to be something in the way you're 
dealing with the QProcess or its data.

> I was wondering if there is a way to prevent the GUI from crashing if it's
> QProcess crashes...any ideas?

Yes, fix the bug in your GUI :-)

I recommend using valgrind to detect any invalid memory reads or dereferencing 
dangling pointers. It's a fast way of doing an initial check. Otherwise, just 
run your application in a debugger, so it'll stop when the app crashes.

Note that crashing inside Qt code doesn't mean it's Qt's fault. You could be 
passing invalid pointers to Qt.

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
     Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090721/b89047a1/attachment.bin 


More information about the Qt-interest-old mailing list