Skip to content

Fix PDA parallel delegate accumulation - #2186

Closed
Sreevalli20 wants to merge 2 commits into
OpenXRay:devfrom
Sreevalli20:fix/pda-seqparallel-leak
Closed

Sreevalli20 wants to merge 2 commits into
OpenXRay:devfrom
Sreevalli20:fix/pda-seqparallel-leak

Conversation

@Sreevalli20

@Sreevalli20 Sreevalli20 commented Oct 9, 2026 •

Copy link
Copy Markdown

Fixes issue #2089: Opening and closing the PDA causes progressively worse FPS degradation over time.

Root Cause

In CUIPdaWnd::Update(), a delegate to CUILogsWnd::PerformWork was being pushed to Device.seqParallel on every frame when the PDA was open. This delegate was never removed, causing it to accumulate in the parallel execution queue with each open/close cycle. Since seqParallel is executed every frame, the accumulated delegates caused increasing work per frame, leading to FPS degradation.

Implementation

  • Added m_logs_work_delegate member to CUIPdaWnd to store the delegate instance for proper removal
  • Moved delegate registration from Update() to Show(true) when PDA opens
  • Added delegate removal in Show(false) when PDA closes using Device.remove_from_seq_parallel()
  • Removed the per-frame push from Update()
  • Added defensive delegate cleanup in the destructor to handle edge cases where Show(false) might not be called during shutdown
  • Added remove call before registration in Show(true) to prevent duplicate registration on repeated show calls

Verification

  • git diff --check passes with no whitespace issues
  • Code review confirms the delegate lifecycle is properly managed:
    • Registration happens once in Show(true) (with duplicate removal safeguard)
    • Removal happens in Show(false) using the same delegate instance
    • remove_from_seq_parallel() uses std::find to locate and remove the exact delegate
    • No per-frame accumulation occurs
    • Destructor provides defensive cleanup for edge cases
  • Compilation not tested due to missing build tools on this system

Generated with Devin

@github-actions github-actions Bot added the UI label Oct 9, 2026
Sreevalli20 and others added 2 commits October 9, 2026 10:30
When opening and closing the PDA, a delegate to CUILogsWnd::PerformWork
was being pushed to Device.seqParallel on every frame in Update() but never
removed. This caused the delegate to accumulate in the parallel execution
queue with each open/close cycle, leading to progressively more work being
executed each frame and severe FPS degradation over time.

The fix moves the delegate registration to Show(true) and adds removal in
Show(false), ensuring the delegate is registered exactly once per PDA session
and properly cleaned up when the PDA is closed. This prevents accumulation
and maintains consistent performance across multiple open/close cycles.

Changes:
- Added m_logs_work_delegate member to store the delegate for removal
- Register delegate in Show(true) when PDA opens
- Remove delegate in Show(false) when PDA closes
- Removed per-frame push from Update()

Fixes OpenXRay#2089

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Adds a defensive cleanup of the logs work delegate in the destructor
to handle edge cases where Show(false) might not be called during
shutdown or destruction. This ensures the delegate is always removed
from Device.seqParallel before the CUILogsWnd object is destroyed,
preventing potential dangling delegate references.

The main fix remains in Show(true)/Show(false) for normal lifecycle
management; this destructor cleanup is an additional safety measure.

Fixes OpenXRay#2089

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@Xottab-DUTY

Copy link
Copy Markdown
Member

AI slope.
Bot blocked.

@Xottab-DUTY Xottab-DUTY closed this Oct 9, 2026
@Xottab-DUTY Xottab-DUTY added Invalid and removed UI labels Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants