mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 22:39:18 +02:00
Fix MS14741, allowing uninstall of apps whose scripts are no longer running
This commit is contained in:
parent
f43b9ee7e8
commit
56ba59681a
1 changed files with 3 additions and 5 deletions
|
@ -301,7 +301,7 @@ bool QmlCommerce::uninstallApp(const QString& itemHref) {
|
||||||
// Read from the file to know what .js script to stop
|
// Read from the file to know what .js script to stop
|
||||||
QFile appFile(_appsPath + "/" + appHref.fileName());
|
QFile appFile(_appsPath + "/" + appHref.fileName());
|
||||||
if (!appFile.open(QIODevice::ReadOnly)) {
|
if (!appFile.open(QIODevice::ReadOnly)) {
|
||||||
qCDebug(commerce) << "Couldn't open local .app.json file for deletion.";
|
qCDebug(commerce) << "Couldn't open local .app.json file for deletion. Cannot continue with app uninstallation. App filename is:" << appHref.fileName();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QJsonDocument appFileJsonDocument = QJsonDocument::fromJson(appFile.readAll());
|
QJsonDocument appFileJsonDocument = QJsonDocument::fromJson(appFile.readAll());
|
||||||
|
@ -309,15 +309,13 @@ bool QmlCommerce::uninstallApp(const QString& itemHref) {
|
||||||
QString scriptUrl = appFileJsonObject["scriptURL"].toString();
|
QString scriptUrl = appFileJsonObject["scriptURL"].toString();
|
||||||
|
|
||||||
if (!DependencyManager::get<ScriptEngines>()->stopScript(scriptUrl.trimmed(), false)) {
|
if (!DependencyManager::get<ScriptEngines>()->stopScript(scriptUrl.trimmed(), false)) {
|
||||||
qCDebug(commerce) << "Couldn't stop script.";
|
qCWarning(commerce) << "Couldn't stop script during app uninstall. Continuing anyway. ScriptURL is:" << scriptUrl.trimmed();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the .app.json from the filesystem
|
// Delete the .app.json from the filesystem
|
||||||
// remove() closes the file first.
|
// remove() closes the file first.
|
||||||
if (!appFile.remove()) {
|
if (!appFile.remove()) {
|
||||||
qCDebug(commerce) << "Couldn't delete local .app.json file.";
|
qCWarning(commerce) << "Couldn't delete local .app.json file during app uninstall. Continuing anyway. App filename is:" << appHref.fileName();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit appUninstalled(itemHref);
|
emit appUninstalled(itemHref);
|
||||||
|
|
Loading…
Reference in a new issue