From 6faf979da7c9f74b2be1ee68016a5643fd6eb3b6 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 24 Aug 2019 14:42:17 +0200 Subject: [PATCH] BRoster: Fix infinite loop when trying to launch app with missing libraries. Fixes #14986. Change-Id: I727fde0c475f0684567a46be5af616cad56a9b4c Reviewed-on: https://review.haiku-os.org/c/haiku/+/1738 Reviewed-by: waddlesplash --- src/kits/app/Roster.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/kits/app/Roster.cpp b/src/kits/app/Roster.cpp index 1a9b62cc63..3935057ee8 100644 --- a/src/kits/app/Roster.cpp +++ b/src/kits/app/Roster.cpp @@ -1872,6 +1872,7 @@ BRoster::_LaunchApp(const char* mimeType, const entry_ref* ref, thread_id appThread = -1; port_id appPort = -1; uint32 appToken = 0; + entry_ref hintRef; while (true) { // find the app @@ -1881,6 +1882,7 @@ BRoster::_LaunchApp(const char* mimeType, const entry_ref* ref, &appFlags, &wasDocument); DBG(OUT(" find app: %s (%" B_PRIx32 ") %s \n", strerror(error), error, signature)); + if (error != B_OK) return error; @@ -1956,15 +1958,18 @@ BRoster::_LaunchApp(const char* mimeType, const entry_ref* ref, _RemovePreRegApp(appToken); if (!wasDocument) { + // Did we already try this? + if (appRef == hintRef) + break; + // Remove app hint if it's this one BMimeType appType(signature); - entry_ref hintRef; if (appType.InitCheck() == B_OK && appType.GetAppHint(&hintRef) == B_OK && appRef == hintRef) { appType.SetAppHint(NULL); - // try again + // try again with the app hint removed continue; } }