KRun, startup notification, memory leak

Oswald Buddenhagen ossi at
Sun Jul 27 22:30:46 BST 2008

hi dfaure, seli, *,

uwolfer found two related memory leaks which are reproducible this way:
- open a file properties dialog, open the mime type dialog
- then close the app, but still let the mime type dialog open

what happens is this:
KDEPrivate::KFilePropsPlugin::slotEditFileType() calls
KRun::runCommand(). the latter instanciates a KProcess and wraps it into
a KProcessRunner. then it simply forgets about it. at this point the
only reference to these two objects is the event loop. if the app
exits before the child process exits, the references disappear due to
the event loop being disposed.

the effects are:
- the process continues to run
- the startup notification will have to wait for a timeout in case the
  startup is about to fail or the process does not tell when it is up
  and exits fast
- we have valgrind report a leak. duh

now i wonder:
- where to register the process runner so it gets to know about app
- or maybe it should increment the kglobal ref count to avoid an
- if we want the child to outlive the parent without sacrificing the
  error handling in the normal case, is this finally a legitimate use
  case for qprocess::detach()?
- or should the process runner be in fact a separate process itself?
- do we care at all? maybe the situation should never come up in the
  first place?
- or maybe i misanalysed the problem entirely?

Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
Confusion, chaos, panic - my work here is done.

More information about the kde-core-devel mailing list