From 9b3be1401553ed102a0456f89e637a1084f26711 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 20 Apr 2015 23:18:52 +0200 Subject: [PATCH] BApplication: Fix B_ARGV_* handling on silent relaunch. In hrev47355 a logic reversal was introduced as part of a cleanup commit which caused B_ARGV_RECEIVED to be sent only to apps with the B_ARGV_ONLY flag set instead of clear. In addition to that, don't send the B_SILENT_RELAUNCH message for apps with B_ARGV_ONLY either, as they are not supposed to receive messages after launch. This is in line with the documentation and what BRoster does. --- src/kits/app/Application.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index ff51d2c5e8..9d51648ba2 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -445,10 +445,11 @@ BApplication::_InitData(const char* signature, bool initGUI, status_t* _error) if (otherTeam >= 0) { BMessenger otherApp(NULL, otherTeam); app_info otherAppInfo; - if (__libc_argc > 1 - && be_roster->GetRunningAppInfo(otherTeam, &otherAppInfo) - == B_OK - && (otherAppInfo.flags & B_ARGV_ONLY) != 0) { + bool argvOnly = be_roster->GetRunningAppInfo(otherTeam, + &otherAppInfo) == B_OK + && (otherAppInfo.flags & B_ARGV_ONLY) != 0; + + if (__libc_argc > 1 && !argvOnly) { // create an B_ARGV_RECEIVED message BMessage argvMessage(B_ARGV_RECEIVED); fill_argv_message(argvMessage); @@ -461,7 +462,7 @@ BApplication::_InitData(const char* signature, bool initGUI, status_t* _error) // send the message otherApp.SendMessage(&argvMessage); - } else + } else if (!argvOnly) otherApp.SendMessage(B_SILENT_RELAUNCH); } } else if (fInitError == B_OK) {