LayerManagerCommands: fixed logging inside CommitCommand
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Fri, 30 Nov 2012 14:41:26 +0000 (06:41 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Wed, 9 Jan 2013 13:34:03 +0000 (05:34 -0800)
CommitCommand printed itself as creator of each executed command.
Error state was logged wrong after one command failed.

Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
LayerManagerCommands/src/CommitCommand.cpp

index 830371a..9532e2c 100644 (file)
@@ -36,11 +36,13 @@ ExecutionResult CommitCommand::execute(ICommandExecutor* executor)
         ICommand* command = (*iter);
         if (command)
         {
+            bool commandExecuteSuccess = true;
             ExecutionResult result = command->execute(executor);
 
             if (result == ExecutionFailed || result == ExecutionFailedRedraw)
             {
                 success = false;
+                commandExecuteSuccess = false;
             }
 
             if (result == ExecutionFailedRedraw || result == ExecutionSuccessRedraw)
@@ -48,10 +50,10 @@ ExecutionResult CommitCommand::execute(ICommandExecutor* executor)
                 redraw = true;
             }
 
-            unsigned int pid = getSenderPid();
+            unsigned int pid = command->getSenderPid();
             LOG_INFO("CommitCommand", "executed " << command->getString()
                     << " from " << executor->getSenderName(pid) << "(" << pid << ")"
-                    << (success ? "+" : "-"));
+                    << (commandExecuteSuccess ? "+" : "-"));
             delete command;
         }
     }