- took the delayed console command execution out of the thinker management.
Doing this intermingled with the thinkers is highly unsafe because there are absolutely no guarantees about order of execution. Effectively it ran these commands right in the middle of the playsim which could cause all sorts of synchronization issues, because CCMDs are part of the UI, not the playsim. - pass a const string to AddCommandString. This function manipulated the input buffer, leading to all sorts of code contortions to make sure that the passed parameter is clean for that. This function will now create a copy of the passed parameter which it can manipulate without complicating its calling code. # Conflicts: # src/c_dispatch.cpp
This commit is contained in:
parent
2f84de9c37
commit
39f53a4de0
7 changed files with 121 additions and 132 deletions
|
|
@ -629,7 +629,7 @@ void C_DeinitConsole ()
|
|||
while (cmd != NULL)
|
||||
{
|
||||
GameAtExit *next = cmd->Next;
|
||||
AddCommandString (cmd->Command.LockBuffer());
|
||||
AddCommandString (cmd->Command);
|
||||
delete cmd;
|
||||
cmd = next;
|
||||
}
|
||||
|
|
@ -1559,17 +1559,9 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
|
|||
{
|
||||
// Work with a copy of command to avoid side effects caused by
|
||||
// exception raised during execution, like with 'error' CCMD.
|
||||
// It's problematic to maintain FString's lock symmetry.
|
||||
static TArray<char> command;
|
||||
const size_t length = buffer.Text.Len();
|
||||
|
||||
command.Resize(unsigned(length + 1));
|
||||
memcpy(&command[0], buffer.Text.GetChars(), length);
|
||||
command[length] = '\0';
|
||||
|
||||
FString copy = buffer.Text;
|
||||
buffer.SetString("");
|
||||
|
||||
AddCommandString(&command[0]);
|
||||
AddCommandString(copy);
|
||||
}
|
||||
TabbedLast = false;
|
||||
TabbedList = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue