Repository navigation
Conversation
setRaw() called setValue(), which fires propertyChanging and propertyChanged, so setters routed through setRawWithEvent() fired both events twice. setRaw() now stores the value without events.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
An unguarded setUInt64() call breaks test compilation without POCO_HAVE_INT64, and wrapper-backed JSON writes lack regression coverage.
2 open issues
What changed in this PR
Fixes #3903 by separating JSON value storage from event notification, preventing inherited configuration setters from firing change events twice.
Changes:
- Adds a private, event-free
storeValue()helper used bysetRaw(). - Keeps notifications in
setValue()while stopping underlying JSON notifications for writes through configuration wrappers. - Adds shared event counters and a
setUInt64()regression check.
| File | Description |
|---|---|
Util/testsuite/src/AbstractConfigurationTest.h |
Adds counters for changing and changed events. |
Util/testsuite/src/AbstractConfigurationTest.cpp |
Checks that setUInt64() fires each event exactly once. |
Util/src/JSONConfiguration.cpp |
Separates storage from notification to eliminate duplicate events. |
Util/include/Poco/Util/JSONConfiguration.h |
Declares the storage helper and documents event behavior. |
Review effort: Balanced
…ered configuration pocoproject#3903 Use setUInt() in testChangeEvents, as setUInt64() needs POCO_HAVE_INT64.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Closes #3903.
AbstractConfiguration::setRawWithEvent()firespropertyChanging, callssetRaw(), then firespropertyChanged.JSONConfiguration::setRaw()calledsetValue(), which fires both events again. So the setters thatJSONConfigurationdoes not override (setUInt,setInt16tosetUInt64) fired each event twice. The secondpropertyChangingalso ran while the configuration mutex was held.Util/src/JSONConfiguration.cpp,JSONConfiguration.h: the storing part ofsetValue()moves into a privatestoreValue().setValue()fires the events around it, andsetRaw()callsstoreValue()without events, assetRaw()does in the other configuration classes. Writes through a view, mapper or layered configuration therefore no longer fire the events of the underlyingJSONConfiguration.Tests:
AbstractConfigurationTest::testChangeEventscounts the events and checks thatsetUInt()fires each exactly once. It runs for all 10 configuration test classes.JSONConfigurationTest::testWrapperEventswrites through a view, a mapper and a layered configuration backed byJSONConfiguration. Each write fires each event once, from the wrapper, and stores the value in theJSONConfiguration.JSONConfigurationTesttests fail with "expected: 1 but was: 2".MapConfigurationTest::testChangeEventspasses without it.Validation on macOS arm64, Apple clang 21, Debug,
ENABLE_COMPILER_WARNINGS=ON(no warnings in the changed files):-ignore cppignore.lnx(257 tests, OK);Not run: Linux and Windows.