PDA

View Full Version : Qprocess...hanging entire application!!!!



nupul
9th May 2006, 14:13
I have a few buttons which when clicked, execute the following type of commands

kfmclient openURL media:/hda1/

kfmclient exec Firefox.desktop

etc

Now the funny thing is that everything was working fine till yesterday and today :crying: !!!!!!!!!

i.e the QProcess executes - i can use it normally, but my app at the back gets hung up! i have attached the snapshot of my app top right corner....the base colors of the windows/groupboxes etc are being displayed....also if i move the window (the one launched via QProcess) around, it just erases the contents of my app!!

What do you think is wrong!

Thanks

ps: i tried doing startDetached(process_name), I also have waitForFinished(-1) enabled....but it seems the launched process never 'finishes' and thus control never returns back to my program!!! :confused:

EDIT: when i run "ps -e" to see the issue i get this mentioned

PID TTY 00:00:00 kfmclient <defunct>

any relation?

jacek
9th May 2006, 14:59
i tried doing startDetached(process_name)
Could you post some code?


I also have waitForFinished(-1) enabled....
QProcess::waitForFinished() is blocks the event loop --- that's why your application doesn't redraw itself. Better use signals & slots.

nupul
9th May 2006, 20:38
well the waitForFinished(-1) is to display the BusyCursor (as clarified in my other thread).

Now i reverted back to my old code which was like 8 lines less than this one and NO PROBLEM at all!!! i don't understand this. I remodified my old code and still no problem...at the moment my system is working just fine...but i fail to understand the queer behaviour!!

as for posting the code....it's as simple as 2 lines....but has connection (maybe) with all the 2000-2500 lines!!!

Nupul

jacek
9th May 2006, 21:29
Now i reverted back to my old code which was like 8 lines less than this one and NO PROBLEM at all!!! i don't understand this. I remodified my old code and still no problem...at the moment my system is working just fine...but i fail to understand the queer behaviour!!
It's hard to tell without seeing your code.


as for posting the code....it's as simple as 2 lines....but has connection (maybe) with all the 2000-2500 lines!!!
You must decide what is relevant. If you can't identify the part that is responsible for the wrong behavior, then most likely you should refactor your code to improve its structure.

nupul
10th May 2006, 13:49
hmmm...let me clarify, the two lines of code are not related per se, it's just that why did i do it, may not be clear. Well as i said, there was no addition to code except for some window flags. I later found out that the programs which i was starting using QProcess::start, would keep displaying the BusyCursor, till the application didn't get finished. This made my app busy and unresponsive as the code wouldn't proceed. I changed the external apps needed to be invoked (QProcess::startDetached wasn't of much help either)

before: (QProcess::start("konqueror")) <-------hung

after:(QProcess::start("kfmclient exec konqueror")) <---------didn't hang



QApplicaition::setOverrideCursor(Qt::WaitCursor);
// start(...)
QApplication::restoreOverrideCursor();



This is what i was doing......but still can you throw more light on what must have happened and why?

Nupul

jacek
10th May 2006, 15:24
before: (QProcess::start("konqueror")) <-------hung
after:(QProcess::start("kfmclient exec konqueror")) <---------didn't hang
Do you use QProcess::waitForFinished()?