forked from qt-creator/qt-creator
		
	Don't crash when the /proc/<pid>/stat file failed to open.
This may happen if a process exits after we got the /proc listing. If we fail to open the file, readAll() returns empty, which means split() returns an empty list, which means you can't do at(1).
This commit is contained in:
		@@ -197,7 +197,9 @@ static QList<ProcData> unixProcessList()
 | 
			
		||||
        filename += procId;
 | 
			
		||||
        filename += QLatin1String("/stat");
 | 
			
		||||
        QFile file(filename);
 | 
			
		||||
        file.open(QIODevice::ReadOnly);
 | 
			
		||||
        if (!file.open(QIODevice::ReadOnly))
 | 
			
		||||
            continue;           // process may have exited
 | 
			
		||||
 | 
			
		||||
        const QStringList data = QString::fromLocal8Bit(file.readAll()).split(' ');
 | 
			
		||||
        ProcData proc;
 | 
			
		||||
        proc.ppid = procId;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user