Repository navigation
Add tests for FlMouseCursorHandler - #188554
Merged
robert-ancell merged 4 commits intoJun 26, 2026
Merged
robert-ancell merged 4 commits into
robert-ancell merged 4 commits into
Conversation
Add unit tests covering cursor kind mapping, the fallback to the default cursor, the cursor-changed signal, and method call error handling for the mouse cursor handler.
An activateSystemCursor method call whose argument map omits the "kind" key (or has a non-string value) passes a null kind to the handler, which was passed straight to g_hash_table_lookup and crashed in g_str_hash. Guard against a null kind and fall back to the default cursor. Also guard the channel's fl_value_get_type lookup against a missing "kind" key, which otherwise triggered a CRITICAL assertion warning. Add a regression test covering a call with a missing kind.
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds unit tests for FlMouseCursorHandler and introduces null checks in fl_mouse_cursor_channel.cc and fl_mouse_cursor_handler.cc to prevent potential crashes. The review feedback highlights a critical double-free or use-after-free issue in the new test file, where fl_value_set_string takes ownership of kind while it is also managed by g_autoptr. The reviewer suggests refactoring activate_system_cursor to accept a const gchar* and simplifying the test cases to resolve this issue.
mattkae
previously approved these changes
Jun 25, 2026
The activate_system_cursor test helper took the cursor kind as an FlValue*, requiring each caller to wrap a string in an FlValue. Take the kind as a string and build the FlValue inside the helper, simplifying the call sites.
mattkae
approved these changes
Jun 25, 2026
This was referenced Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add unit tests covering cursor kind mapping, the fallback to the default cursor, the cursor-changed signal, and method call error handling for the mouse cursor handler.