Skip to content

Update Bookmark trigger functionality#559

Merged
Hirogen merged 2 commits intoDevelopmentfrom
112-bug-bookmarks-are-not-working-for-highlight-triggers
Apr 8, 2026
Merged

Update Bookmark trigger functionality#559
Hirogen merged 2 commits intoDevelopmentfrom
112-bug-bookmarks-are-not-working-for-highlight-triggers

Conversation

@Hirogen
Copy link
Copy Markdown
Collaborator

@Hirogen Hirogen commented Apr 8, 2026

This pull request introduces several improvements to thread safety, event handling, and test coverage in the bookmark and highlight features. The most significant changes are the addition of locking to the BookmarkDataProvider to ensure thread safety, improvements to asynchronous event handling in LogWindow, and the introduction of comprehensive tests for highlight and bookmark logic.

Thread safety and synchronization improvements:

  • Added a private lock (_bookmarkListLock) to the BookmarkDataProvider and wrapped all public methods that mutate or access the bookmarks list with this lock to prevent race conditions in multi-threaded scenarios. [1] [2] [3] [4] [5]
  • Changed the _logEventArgsEvent from a ManualResetEvent to an AutoResetEvent in LogWindow for correct event signaling semantics.

Asynchronous event handling and UI updates:

  • Replaced Task.Run with BeginInvoke for UI-related updates in LogWindow to ensure operations like setting bookmarks and selecting lines are marshaled to the UI thread, preventing potential cross-thread exceptions. [1] [2] [3] [4]
  • Updated task creation for background workers (_timeShiftSyncTask and _logEventHandlerTask) to use Task.Factory.StartNew with TaskCreationOptions.LongRunning for better thread management.

Test coverage and regression tests:

  • Added a new test class HighlightBookmarkTriggerTests with comprehensive tests for highlight actions, bookmark provider logic, and closure bug regression, ensuring correct behavior and guarding against common C# closure pitfalls.

Code robustness and minor fixes:

  • Made normalization of search text in FilterParams null-safe to prevent possible NullReferenceException.
  • Minor code cleanups and clarifications, such as removing unused locks and improving comments. [1] [2]
  • Fixed a minor namespace import (System.EventArgs to EventArgs) for consistency.

These changes collectively improve the stability, maintainability, and correctness of bookmark and highlight handling, especially in multi-threaded and UI contexts.

@Hirogen Hirogen linked an issue Apr 8, 2026 that may be closed by this pull request
@Hirogen Hirogen merged commit 003ee1c into Development Apr 8, 2026
1 check passed
@Hirogen Hirogen deleted the 112-bug-bookmarks-are-not-working-for-highlight-triggers branch April 8, 2026 12:31
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: Bookmarks are not working for highlight triggers

1 participant