Skip to content

Commit

Permalink
Fix memory watches triggering when non-memory AT-backend connects
Browse files Browse the repository at this point in the history
  • Loading branch information
black-sliver committed Dec 26, 2024
1 parent c495a0f commit d35ddc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/core/autotracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,13 @@ class AutoTracker final : public LuaInterface<AutoTracker>{
return State::Unavailable;
}

bool isAnyConnected()
bool isAnyMemoryConnected()
{
for (int index = 0; index < (int)_state.size(); ++index) {
if (_ap && _backendIndex[_ap] == index)
continue; // AP doesn't have memory
if (_uat && _backendIndex[_uat] == index)
continue; // UAT doesn't have memory
if (getState(index) >= State::ConsoleConnected)
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/scripthost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ void ScriptHost::resetWatches()

void ScriptHost::runMemoryWatchCallbacks()
{
if (!_autoTracker || !_autoTracker->isAnyConnected())
if (!_autoTracker || !_autoTracker->isAnyMemoryConnected())
return;

// we need to run callbacks because the autotracker changed some cache
Expand Down

0 comments on commit d35ddc4

Please sign in to comment.