[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help with konq-speaker crash



Ben Burton writes:

> tags 237625 + help thanks mate

> Hi.. if anyone has any insight into this one, I'm all ears.  It's
> crashing somewhere inside KProcess::writeStdin(), but I can't see
> why (and nor can I see any problems with the code that uses
> KProcess/KProcIO).

Hi,

I've debugged this, and the problem are these two lines in
plugin_speaker.cpp:
    process.start(KProcess::DontCare);
    process.writeStdin(query);
The first line tells the process that the newly created process will
be completely ignored by the konqueror process, and that no
communication via stdin or stdout will take place ( take a look at the
KProcess docs for more info ), and the second one immediately starts
communication via stdin, which causes a failure in kprocess because it
did not create an object necessary for the communication to take
place ( the input notifier KProcess::innot, read the KProcess source
for more info ).  I think the solution should be to fix the code by
1 creating the KProcIO object on the heap ( using new )
2 attach a slot to its processExited() signal, which deletes the
  KProcIO object
3 invoke the KProcIO start() function as follows:
  start( KProcess::NotifyOnExit, false )

There may be more problems in the code though ;)

> Btw, the kate plugin doesn't show up since "X-Kate-Version=2.2"
> needs to be added to the desktop file to work with KDE 3.2.  But the
> konqueror plugin shows up fine, and you can see the crash there.

The kate speaker code suffers from the exact same problem, it seems.
To be honest, konq-speaker source is pretty bad, if it doesn't even
factor out common code in both plugins.

cheers
domi



Reply to: