Skip to content

Harden nre close filtergrid#638

Merged
Hirogen merged 3 commits into
Developmentfrom
harden-nre-close-filtergrid
Jun 24, 2026
Merged

Harden nre close filtergrid#638
Hirogen merged 3 commits into
Developmentfrom
harden-nre-close-filtergrid

Conversation

@Hirogen

@Hirogen Hirogen commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator
  • _isClosing flag + guards in both CellValueNeeded handlers (the NRE fix)
  • JoinWorker() helper + WORKER_SHUTDOWN_TIMEOUT, wired into both stop methods
  • restored _timeShiftSyncWakeupEvent.Set() in StopTimestampSyncThread

BRUNER Patrick and others added 3 commits June 24, 2026 08:35
Closing a LogWindow could throw a NullReferenceException from
LogfileReader.GetLogLineMemories. ClearAndDisposeGrids() calls
Rows.Clear(), which ends any in-progress cell edit and fires
CellValueNeeded into a reader whose buffers are being torn down. The
existing guards (_isDeleted, _filterResultList bounds) don't cover a
normal close, so the callback still dispatched into the dying reader.

- Add an _isClosing flag, set at the top of CloseLogWindow, and short-
  circuit both OnDataGridViewCellValueNeeded and
  OnFilterGridViewCellValueNeeded so no grid callback reaches the reader
  once teardown has started.

While here, make the worker task handles live again. Since the
Thread->Task conversion (45d1c62) _logEventHandlerTask and
_timeShiftSyncTask were write-only; shutdown relied solely on
_cts.Cancel() and the leftover .Abort()/.Join() calls were commented
out.

- Join both workers on shutdown via a bounded JoinWorker() helper
  (WORKER_SHUTDOWN_TIMEOUT) so close drains them deterministically
  before the grids are disposed, and never hangs if a worker is blocked.
- Restore _timeShiftSyncWakeupEvent.Set() in StopTimestampSyncThread:
  the sync worker parks on a no-timeout WaitOne() and stop never woke
  it, so it would otherwise never observe the cancel flag.
@Hirogen
Hirogen merged commit 7c343d3 into Development Jun 24, 2026
1 check passed
@Hirogen
Hirogen deleted the harden-nre-close-filtergrid branch June 24, 2026 08:09
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.

1 participant