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
This commit is contained in:
Stephan Aßmus
2010-05-08 20:51:56 +00:00
parent e2e160328b
commit 015cd734f0
+13 -11
View File
@@ -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, [email protected]
* Jonas Sundström, [email protected]
* Stephan Aßmus <[email protected]>
*/
/*
@@ -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("<string>")) > -1 && (e = line.IFindFirst("</string>")) > s) {
if ((s = line.IFindFirst("<string>")) > -1
&& (e = line.IFindFirst("</string>")) > 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;
}
}