Skip to content

bug: obs-properties: parent callbacks can destroy child groups twice #1943

Closed

Description

@ProtonDev-sys

Location

rust/obs-properties/src/props.rs:214-231 snapshots every destructor before invoking any callback. src/ffi/obs_properties.rs:169-170 runs that snapshot afterward. props::remove_by_name:304-321 drops a removed group before the shim invokes its callbacks. The original C invokes the parent destructor before it traverses the remaining properties and keeps each group alive through its destructor.

Class

Callback lifecycle / duplicate destruction, with premature group teardown.

How it is reached

A trusted local plugin's parent parameter destructor removes one of its property groups. That removal invokes the child group's destructor. Rust's previously collected snapshot then invokes the same child destructor again; C invokes it only once. A callback that releases its parameter could therefore release it twice. Destructors inspecting their own removed group's contents also need those handles to stay live until the callback returns.

Proposed fix and failing test

Execute callbacks incrementally with no active RefCell borrow, inspecting descendants after the parent callback and keeping removed groups live during callbacks. Add deterministic parent-removes-group and parent-adds-group cases against the unchanged C oracle to the existing core-state executable, plus a safe lifetime test. Existing C tests and public headers stay unchanged.

Activity

  1. ProtonDev-sys commented on Oct 23, 2026

    @ProtonDev-sys
    ContributorAuthor

    Claiming: #1943.

    1. Add deterministic callback lifecycle regressions against the unchanged C oracle: parent removes/adds a group, and removed group remains live during its callback.
    2. Reproduce RED on DESKTOP-3FLAOFG, then execute destruction incrementally without holding RefCell borrows and verify the properties/core suites.
      First PR expected this session. Separate scope from parameter replacement bug: obs-properties: parameter destructor observes its replacement #1938/obs-properties: Preserve parameter destructor ordering #1939.
  2. added
    claimed
    on Oct 23, 2026
  3. ProtonDev-sys commented on Oct 23, 2026

    @ProtonDev-sys
    ContributorAuthor

    Releasing #1943 at the user request to wrap up. Three deterministic RED cases were reproduced on DESKTOP-3FLAOFG (duplicate child callback, missed newly added group, premature group storage release). The proposed fix and regressions are preserved locally on fix/1943-properties-destroy-lifetime; GREEN verification is incomplete because SSH access hit Exceeded MaxStartups. No completed fix is claimed. Separate parameter-order fix #1939 has merged.

  4. removed
    claimed
    on Oct 23, 2026
  5. zackees commented on Oct 23, 2026

    @zackees
    Member

    Claiming: #1943 (released above; the earlier branch was never pushed, so starting fresh).

    1. RED: deterministic parent-removes-group, parent-adds-group and removed-group-lifetime cases against the unchanged C oracle, in the existing test binary.
    2. GREEN: run destructor callbacks incrementally with no RefCell borrow held, walking descendants after the parent callback, and keep removed groups alive until their callbacks return.
  6. added
    claimed
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions