From 015cd734f0ca2b744789460cf5d46e1abdca27a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 8 May 2010 20:51:56 +0000 Subject: [PATCH] When checking the return code from BRoster::Launch(), always check for B_ALREADY_RUNNING and don't treat it as error condition. See BeBook documentation for more details. This bug resulted in urlwrapper opening a Terminal and trying to use wget on Bookmark files that are supposed to open in WebPositive (or any other browser), in the case that this browser was already running. Absolutely needs to go into alpha2. ;-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36757 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/urlwrapper.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/bin/urlwrapper.cpp b/src/bin/urlwrapper.cpp index 3faeeae291..d0901e3ea1 100644 --- a/src/bin/urlwrapper.cpp +++ b/src/bin/urlwrapper.cpp @@ -1,10 +1,11 @@ /* - * Copyright 2007-2009 Haiku Inc. All rights reserved. + * Copyright 2007-2010 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * François Revol, revol@free.fr * Jonas Sundström, jonas@kirilla.com + * Stephan Aßmus */ /* @@ -118,9 +119,9 @@ UrlWrapper::RefsReceived(BMessage* msg) args[1] = (char*)u.String(); mimetype = kURLHandlerSigBase; mimetype += u.Proto(); - err = be_roster->Launch(mimetype.String(), 1, args+1); - if (err < B_OK) - err = be_roster->Launch(kAppSig, 1, args+1); + err = be_roster->Launch(mimetype.String(), 1, args + 1); + if (err != B_OK && err != B_ALREADY_RUNNING) + err = be_roster->Launch(kAppSig, 1, args + 1); continue; } } @@ -165,7 +166,8 @@ UrlWrapper::RefsReceived(BMessage* msg) state = 4; break; case 4: - if ((s = line.IFindFirst("")) > -1 && (e = line.IFindFirst("")) > s) { + if ((s = line.IFindFirst("")) > -1 + && (e = line.IFindFirst("")) > s) { state = 5; s += 8; line.MoveInto(url, s, e - s); @@ -185,9 +187,9 @@ UrlWrapper::RefsReceived(BMessage* msg) args[1] = (char*)u.String(); mimetype = kURLHandlerSigBase; mimetype += u.Proto(); - err = be_roster->Launch(mimetype.String(), 1, args+1); - if (err < B_OK) - err = be_roster->Launch(kAppSig, 1, args+1); + err = be_roster->Launch(mimetype.String(), 1, args + 1); + if (err != B_OK && err != B_ALREADY_RUNNING) + err = be_roster->Launch(kAppSig, 1, args + 1); continue; } } @@ -199,9 +201,9 @@ UrlWrapper::RefsReceived(BMessage* msg) args[1] = (char*)u.String(); mimetype = kURLHandlerSigBase; mimetype += u.Proto(); - err = be_roster->Launch(mimetype.String(), 1, args+1); - if (err < B_OK) - err = be_roster->Launch(kAppSig, 1, args+1); + err = be_roster->Launch(mimetype.String(), 1, args + 1); + if (err != B_OK && err != B_ALREADY_RUNNING) + err = be_roster->Launch(kAppSig, 1, args + 1); continue; } }