style: reduce variable scope in EpubReaderActivity
Some checks failed
CI / build (push) Failing after 2m31s

Move cachedRenderer, cachedMappedInput, and cachedSection declarations
into the DICTIONARY action block where they're actually used, addressing
cppcheck variableScope warnings.
This commit is contained in:
cottongin 2026-01-28 10:22:01 -05:00
parent 3e3be8bd23
commit f3075002c1
No known key found for this signature in database
GPG Key ID: 0ECC91FE4655C262

View File

@ -386,15 +386,15 @@ void EpubReaderActivity::loop() {
[this](QuickMenuAction action) { [this](QuickMenuAction action) {
// Cache values before exitActivity // Cache values before exitActivity
EpubReaderActivity* self = this; EpubReaderActivity* self = this;
GfxRenderer& cachedRenderer = renderer;
MappedInputManager& cachedMappedInput = mappedInput;
const Section* cachedSection = section.get();
SemaphoreHandle_t cachedMutex = renderingMutex; SemaphoreHandle_t cachedMutex = renderingMutex;
exitActivity(); exitActivity();
if (action == QuickMenuAction::DICTIONARY) { if (action == QuickMenuAction::DICTIONARY) {
// Open dictionary menu // Open dictionary menu - cache renderer/input for this scope
GfxRenderer& cachedRenderer = self->renderer;
MappedInputManager& cachedMappedInput = self->mappedInput;
const Section* cachedSection = self->section.get();
self->enterNewActivity(new DictionaryMenuActivity( self->enterNewActivity(new DictionaryMenuActivity(
cachedRenderer, cachedMappedInput, cachedRenderer, cachedMappedInput,
[self](DictionaryMode mode) { [self](DictionaryMode mode) {