From 70dc4391396b65a99f2dc0ba571bd6b707135795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sundstr=C3=B6m?= Date: Wed, 9 Sep 2009 01:29:45 +0000 Subject: [PATCH] Check return value also for B_ALREADY_RUNNING, or else we launch the add-on twice. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33014 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/TrackerAddOnAppLaunch.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/headers/private/shared/TrackerAddOnAppLaunch.h b/headers/private/shared/TrackerAddOnAppLaunch.h index a1d8dd284a..6bb06b376a 100644 --- a/headers/private/shared/TrackerAddOnAppLaunch.h +++ b/headers/private/shared/TrackerAddOnAppLaunch.h @@ -52,17 +52,18 @@ process_refs(entry_ref directory, BMessage* refs, void* reserved) if (get_ref_for_path(image.name, &addonRef) != B_OK) return; - if (be_roster->Launch(&addonRef, refs) != B_OK) { + status = be_roster->Launch(&addonRef, refs); + if (status == B_OK || status == B_ALREADY_RUNNING) + return; - // If launching by entry_ref fails it's probably futile to - // launch by signature this way, but we can try anyway. + // If launching by entry_ref fails it's probably futile to + // launch by signature this way, but we can try anyway. - app_info appInfo; - if (be_roster->GetAppInfo(&addonRef, &appInfo) != B_OK) - return; + app_info appInfo; + if (be_roster->GetAppInfo(&addonRef, &appInfo) != B_OK) + return; - be_roster->Launch(appInfo.signature, refs); - } + be_roster->Launch(appInfo.signature, refs); }