Fix disk leak
This commit is contained in:
parent
87f765245d
commit
14c7a8fde4
@ -138,14 +138,15 @@ void utils::externalScreenshot(std::function<void(QPixmap)> callback) {
|
|||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
qCritical().noquote() << "Failed to take external screenshot: \n"
|
qCritical().noquote() << "Failed to take external screenshot: \n"
|
||||||
<< process->readAllStandardError();
|
<< process->readAllStandardError();
|
||||||
return;
|
} else {
|
||||||
|
QPixmap pixmap;
|
||||||
|
if (!tempPath.isEmpty())
|
||||||
|
pixmap.load(tempPath);
|
||||||
|
else
|
||||||
|
pixmap.loadFromData(process->readAllStandardOutput());
|
||||||
|
callback(pixmap);
|
||||||
}
|
}
|
||||||
QPixmap pixmap;
|
QFile(tempPath).remove();
|
||||||
if (!tempPath.isEmpty())
|
|
||||||
pixmap.load(tempPath);
|
|
||||||
else
|
|
||||||
pixmap.loadFromData(process->readAllStandardOutput());
|
|
||||||
callback(pixmap);
|
|
||||||
});
|
});
|
||||||
process->start(args.takeFirst(), args);
|
process->start(args.takeFirst(), args);
|
||||||
}
|
}
|
||||||
@ -166,14 +167,15 @@ void utils::externalScreenshotActive(std::function<void(QPixmap)> callback) {
|
|||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
qCritical().noquote() << "Failed to take external screenshot: \n"
|
qCritical().noquote() << "Failed to take external screenshot: \n"
|
||||||
<< process->readAllStandardError();
|
<< process->readAllStandardError();
|
||||||
return;
|
} else {
|
||||||
|
QPixmap pixmap;
|
||||||
|
if (!tempPath.isEmpty())
|
||||||
|
pixmap.load(tempPath);
|
||||||
|
else
|
||||||
|
pixmap.loadFromData(process->readAllStandardOutput());
|
||||||
|
callback(pixmap);
|
||||||
}
|
}
|
||||||
QPixmap pixmap;
|
QFile(tempPath).remove();
|
||||||
if (!tempPath.isEmpty())
|
|
||||||
pixmap.load(tempPath);
|
|
||||||
else
|
|
||||||
pixmap.loadFromData(process->readAllStandardOutput());
|
|
||||||
callback(pixmap);
|
|
||||||
});
|
});
|
||||||
process->start(args.takeFirst(), args);
|
process->start(args.takeFirst(), args);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user