Skip to content

Commit

Permalink
Processes tab does not detect some wine processes correctly [BUG-100];
Browse files Browse the repository at this point in the history
  • Loading branch information
brezerk committed Nov 23, 2016
1 parent 97ff20b commit 1a4afc6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Version 1.3.4
- Refactor winetrkics parser: use direct parser + transactions;
- Links imported from Windows desktop do not work [BUG-103];
- Import from Windows desktop is not working in some cases [BUG-103];
- Processes tab does not detect some wine processes correctly [BUG-100];

Version 1.3.3
Fixed:
Expand Down
42 changes: 34 additions & 8 deletions src/q4wine-lib/q4wine-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,45 @@ QList<QStringList> corelib::getWineProcessList(const QString prefix_name){
// Getting directories one by one
for (int i = 0; i < list.size(); ++i) {
QFileInfo fileInfo = list.at(i);
QFileInfo info(QString("%1/exe").arg(fileInfo.filePath()));
if (info.isSymLink()) {
QString fileName = info.symLinkTarget();
#ifdef DEBUG
qDebug()<< "Traget for: " << info.filePath() << " is: " << fileName;
#endif
if ((!fileName.contains("wine") && !fileName.contains(".exe")) || fileName.contains(APP_SHORT_NAME)){
continue;
}
} else {
continue;
}
name = "";
path = "/proc/";
path.append(fileInfo.fileName());
path.append("/comm");
path.append("/cmdline");
QFile file_c(path);
if (file_c.open(QIODevice::ReadOnly | QIODevice::Text)){
// Try to read com file
QTextStream in(&file_c);
QString name = in.readLine();
QString comm_char;
while (true) {
comm_char = in.read(1).toLatin1();
if ((comm_char.isNull()) or (comm_char == "\n")){
break;
}
if (comm_char.isEmpty()){
name.append(" ");
} else {
name.append(comm_char);
}
}
//Remove args
name = name.split(" ")[0];
#ifdef DEBUG
qDebug()<<"path: "<<fileInfo.fileName()<<" comm: "<<name;
#endif
if ((name.contains("wine") || name.contains(".exe")) && !name.contains(APP_SHORT_NAME)){


path = "/proc/";
path.append(fileInfo.fileName());
path.append("/stat");
Expand All @@ -98,10 +125,10 @@ QList<QStringList> corelib::getWineProcessList(const QString prefix_name){
if (!line.isNull()){
// Getting nice and name of the process
nice = line.section(' ', 18, 18);
name = line.section(' ', 1, 1);
name.remove(QChar('('));
name.remove(QChar(')'));
name = name.toLower();

//Remove path
name = name.split("/").last();
name = name.split("\\").last();

path = "/proc/";
path.append(fileInfo.fileName());
Expand Down Expand Up @@ -139,7 +166,6 @@ QList<QStringList> corelib::getWineProcessList(const QString prefix_name){
}
file_s.close();
}
}
file_c.close();
}
}
Expand Down

0 comments on commit 1a4afc6

Please sign in to comment.