Skip to content

Add message channels for handle reference counting#334

Merged
waynemwashuma merged 5 commits into
wimaengine:devfrom
waynemwashuma:handle-channels
Jun 7, 2026
Merged

Add message channels for handle reference counting#334
waynemwashuma merged 5 commits into
wimaengine:devfrom
waynemwashuma:handle-channels

Conversation

@waynemwashuma

Copy link
Copy Markdown
Collaborator

Objective

Introduce deferred asset handle reference counting through a dedicated asset channel and separate handle lifecycle management from asset storage.

Solution

The previous implementation tightly coupled Handle reference counting to the Assets resource. Cloning or dropping a handle immediately mutated asset reference counts, requiring handles to retain a direct reference to the assets container. This made handle lifecycle management difficult to decouple from asset storage and complicated serialization/snapshot workflows. This introduces an AssetChannel that queues handle lifecycle operations and processes them during the asset container update phase.

Why this approach:

  • Decouples handle lifetime management from asset storage.
  • Makes handles lightweight and independent of the assets container implementation.
  • Provides a foundation for scene serialization and future asset remapping workflows.
  • Centralizes reference count mutations into a predictable update stage.

Showcase

N/A

Migration guide

Breaking changes

Behaviour changes

Reference count updates are no longer applied immediately.

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@waynemwashuma waynemwashuma self-assigned this Jun 7, 2026
@waynemwashuma waynemwashuma merged commit 98e1438 into wimaengine:dev Jun 7, 2026
7 checks passed
@waynemwashuma waynemwashuma deleted the handle-channels branch June 7, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant