This fixes the problem of launching more than one document with one application

at once with Tracker (eg. launching several text documents) - only the first one
would have been opened, and an error B_BAD_VALUE would have been reported for the
others:
* HandleAddApplication() did not return the correct token in case of a
  pending registration; therefore, BRoster::_LaunchApp() would try to
  check the registration with invalid arguments.
* HandleIsAppRegistered() put the pending registration requests into
  the fIARRequestsByToken map using the wrong key, so that they could
  not be found again.
* Minor cleanup (fixed indentation of not so temporary debug code).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22296 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-09-24 21:48:06 +00:00
parent fab4e5b126
commit 64fd7c1a00
1 changed files with 11 additions and 11 deletions

View File

@ -198,6 +198,7 @@ PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name));
|| (info = fEarlyPreRegisteredApps.InfoFor(&ref)) != NULL)) { || (info = fEarlyPreRegisteredApps.InfoFor(&ref)) != NULL)) {
SET_ERROR(error, B_ALREADY_RUNNING); SET_ERROR(error, B_ALREADY_RUNNING);
otherTeam = info->team; otherTeam = info->team;
token = info->token;
} }
} }
@ -236,14 +237,12 @@ PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name));
info->registration_time = system_time(); info->registration_time = system_time();
// add it to the right list // add it to the right list
bool addingSuccess = false; bool addingSuccess = false;
if (team >= 0) if (team >= 0) {
{
PRINT(("added ref: %ld, %lld, %s\n", info->ref.device, info->ref.directory, info->ref.name)); PRINT(("added ref: %ld, %lld, %s\n", info->ref.device, info->ref.directory, info->ref.name));
addingSuccess = (AddApp(info) == B_OK); addingSuccess = (AddApp(info) == B_OK);
if (addingSuccess && fullReg) if (addingSuccess && fullReg)
_AppAdded(info); _AppAdded(info);
} } else {
else {
token = info->token = _NextToken(); token = info->token = _NextToken();
addingSuccess = fEarlyPreRegisteredApps.AddInfo(info); addingSuccess = fEarlyPreRegisteredApps.AddInfo(info);
PRINT(("added to early pre-regs, token: %lu\n", token)); PRINT(("added to early pre-regs, token: %lu\n", token));
@ -370,8 +369,9 @@ TRoster::HandleIsAppRegistered(BMessage *request)
team = -1; team = -1;
if (request->FindInt32("token", (int32*)&token) != B_OK) if (request->FindInt32("token", (int32*)&token) != B_OK)
token = 0; token = 0;
PRINT(("team: %ld, token: %lu\n", team, token));
PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name)); PRINT(("team: %ld, token: %lu\n", team, token));
PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name));
// check the parameters // check the parameters
// entry_ref // entry_ref
@ -385,24 +385,24 @@ PRINT(("ref: %ld, %lld, %s\n", ref.device, ref.directory, ref.name));
RosterAppInfo *info = NULL; RosterAppInfo *info = NULL;
if (error == B_OK) { if (error == B_OK) {
if ((info = fRegisteredApps.InfoFor(team)) != NULL) { if ((info = fRegisteredApps.InfoFor(team)) != NULL) {
PRINT(("found team in fRegisteredApps\n")); PRINT(("found team in fRegisteredApps\n"));
_ReplyToIARRequest(request, info); _ReplyToIARRequest(request, info);
} else if (token > 0 } else if (token > 0
&& (info = fEarlyPreRegisteredApps.InfoForToken(token)) != NULL) { && (info = fEarlyPreRegisteredApps.InfoForToken(token)) != NULL) {
PRINT(("found ref in fEarlyRegisteredApps (by token)\n")); PRINT(("found ref in fEarlyRegisteredApps (by token)\n"));
// pre-registered and has no team ID assigned yet -- queue the // pre-registered and has no team ID assigned yet -- queue the
// request // request
be_app->DetachCurrentMessage(); be_app->DetachCurrentMessage();
_AddIARRequest(fIARRequestsByToken, team, request); _AddIARRequest(fIARRequestsByToken, token, request);
} else if (team >= 0 } else if (team >= 0
&& (info = fEarlyPreRegisteredApps.InfoFor(&ref)) != NULL) { && (info = fEarlyPreRegisteredApps.InfoFor(&ref)) != NULL) {
PRINT(("found ref in fEarlyRegisteredApps (by ref)\n")); PRINT(("found ref in fEarlyRegisteredApps (by ref)\n"));
// pre-registered and has no team ID assigned yet -- queue the // pre-registered and has no team ID assigned yet -- queue the
// request // request
be_app->DetachCurrentMessage(); be_app->DetachCurrentMessage();
_AddIARRequest(fIARRequestsByID, team, request); _AddIARRequest(fIARRequestsByID, team, request);
} else { } else {
PRINT(("didn't find team or ref\n")); PRINT(("didn't find team or ref\n"));
// team not registered, ref/token not early pre-registered // team not registered, ref/token not early pre-registered
_ReplyToIARRequest(request, NULL); _ReplyToIARRequest(request, NULL);
} }