fix: avoid duplicate AfterAssemblyDataReceived callback for Assembly attribute 3#595
Open
MrAlaskan wants to merge 1 commit into
Conversation
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.
Summary
This PR removes a duplicate
AfterAssemblyDataReceived()callback for explicitSetAttributeSinglewrites to AssemblyAttribute 3.Problem
The Assembly class installs a class-level
PostSetCallback, and AssemblyAttribute 3is also created with thekPostSetFuncflag. As a result,SetAttributeSingle()calls the attribute decoder first and then invokes the class-level post-set callback for the same write.However,
DecodeCipAssemblyAttribute3()already callsAfterAssemblyDataReceived(instance)after copying the new Assembly data. The Assembly class post-set callbackAssemblyPostSetCallback()also callsAfterAssemblyDataReceived(instance). This means that one explicitSetAttributeSingle(Attribute 3)request deterministically produces two application-level data-received notifications for the same write.This duplicates side effects for applications that use
AfterAssemblyDataReceived()to trigger state changes, hardware updates, counters, logging, or other non-idempotent processing. It also makes the explicit write path inconsistent with the intended one-request, one-update event model.Changes
kPostSetFuncfrom AssemblyAttribute 3when the attribute is created inCreateAssemblyObject().AfterAssemblyDataReceived()call insideDecodeCipAssemblyAttribute3()so that successful explicit writes still notify the application once.