Skip to content

Conversation

@Arufonsu
Copy link
Contributor

Fixes #2782

{2DA523FC-1DF1-4E40-BDDD-F40CC13C1B71}

Fixes a critical crash that occurred when UI controls (in this case, controls within BanMuteBox)
attempted to dispose themselves from within their own event handlers.

Changes:

  • BanMuteBox: Use DelayedDelete() instead of Dispose() in button click
    handlers to defer disposal until after event processing completes
  • Canvas: Fix ProcessDelayedDeletes() to iterate over a copy of the
    disposal queue, preventing "Collection was modified" exceptions when
    nested DelayedDelete() calls occur during disposal
  • Canvas: Add error handling to catch and log disposal exceptions
    instead of crashing the entire client

The root cause was a double-disposal race condition where:

  1. Control.Dispose() was called directly from an event handler
  2. The GWEN event system would then try to access the disposed control
  3. Additionally, ProcessDelayedDeletes() could throw when the disposal
    queue was modified during iteration

This fix ensures controls are disposed safely between frames using the
delayed deletion queue, and that nested deletion requests don't cause
collection modification exceptions.

…shes in UI disposal

- Use DelayedDelete() in BanMuteBox event handlers instead of direct Dispose()
- Canvas: Fix ProcessDelayedDeletes() to iterate over a copy of the disposal queue, preventing "Collection was modified" exceptions when nested DelayedDelete() calls occur during disposal
- Add error handling to catch and log disposal exceptions instead of crashing the entire client
- User Ban working and tested
@WeylonSantana WeylonSantana merged commit 533a806 into main Dec 27, 2025
1 check passed
@WeylonSantana WeylonSantana deleted the fix/2782 branch December 27, 2025 03:13
Sh4d0v added a commit to Sh4d0v/dbo3 that referenced this pull request Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Admin Client disconnect and closed when ban or mute a player

3 participants