Repository navigation
obs-properties: run destroy callbacks like the C (#1943) - #1949
Merged
Merged
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.
Fixes #1943.
Cause:
obs_properties_destroycollected every destroy callback in the tree up front (props::destroy_list) and ran them afterwards, andobs_properties_remove_by_namedropped the removed property before running its group's callbacks. The C runs the set's own destroy first, then takes each property off the set (HASH_ITER/HASH_DEL) and destroys it, so a callback that changes the tree sees the C's result, and a removed group stays alive while its content's destroy runs.RED (38917c9, three deterministic cases in
rust/obs-properties/tests/properties/lifecycle.rs, run on the unchanged C oracle and on the Rust ABI; the oracle side passes):g: Rust["parent", "child", "child"](child destroyed twice), C["parent", "child"];h: Rust["parent", "child"](new group never destroyed), C["parent", "child", "added"];gwhose content destroy reads its owninnerproperty: Rust SIGSEGV (use after free), C sees it.GREEN (2b00c62):
props::destroy/props::remove_by_nametake the callback runner and call it with noRefCellborrow held: own param first, then each property popped off in order, a group's content destroyed while the group is held. All 16properties::tests inobs-tests-corepass, including the random Tier 3 parity sequences; lint passes.Tiers: Tier 1/Tier 3 (the new cases compare against the oracle). No C test or public header changed. features.md line added next to #1939's.