make Session::updateForegroundProcessInfo() easier to understand

This commit is contained in:
Jekyll Wu
2011-10-21 19:03:45 +08:00
parent 379c5bb7de
commit a2a54f41d8

View File

@@ -961,26 +961,25 @@ void Session::updateSessionProcessInfo()
bool Session::updateForegroundProcessInfo()
{
bool valid = (_foregroundProcessInfo != 0);
// has foreground process changed?
Q_ASSERT(_shellProcess);
int pid = _shellProcess->foregroundProcessGroup();
if (pid != _foregroundPid)
{
delete _foregroundProcessInfo;
_foregroundProcessInfo = ProcessInfo::newInstance(pid);
_foregroundPid = pid;
valid = true;
}
if (valid)
if (_foregroundProcessInfo)
{
_foregroundProcessInfo->update();
valid = _foregroundProcessInfo->isValid();
return _foregroundProcessInfo->isValid();
}
else
{
return false;
}
return valid;
}
bool Session::isRemote()