Fixed issue 148 draw context stack overflow#158
Merged
fdesbiens merged 2 commits intoJun 1, 2026
Merged
Conversation
All callers of _gx_canvas_drawing_initiate() must check the return
value before calling draw functions or _gx_canvas_drawing_complete().
When GX_DRAW_NESTING_EXCEEDED is returned the context stack is NOT
pushed, so calling _gx_canvas_drawing_complete() corrupts the outer
context's nesting counter.
Fix pattern (matching _gx_widget_children_draw.c reference impl):
status = _gx_canvas_drawing_initiate(...);
if (status == GX_SUCCESS) { draw(); _gx_canvas_drawing_complete(); }
else if (status == GX_NO_VIEWS) { _gx_canvas_drawing_complete(); }
// else: stack overflow or invalid memory -- do nothing
Files fixed:
- gx_animation_start.c
- gx_animation_drag_tracking_start.c
- gx_multi_line_text_view_text_draw.c
- gx_multi_line_text_input_draw.c
- gx_rich_text_view_text_draw.c
- gx_single_line_text_input_draw.c
- gx_radial_progress_bar_background_draw.c (GX_BRUSH_ALPHA_SUPPORT path)
- gx_widget_block_move.c
- gx_system_canvas_refresh.c (partial and non-partial paths)
- gx_system_error_process.c (Copilot attribution only; functional changes via eclipse-threadx#156)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…k overflow Tests that _gx_canvas_drawing_initiate() overflow does not corrupt the draw context state: 1. Overflow detection: GX_DRAW_NESTING_EXCEEDED returned at max depth (GX_MAX_CONTEXT_NESTING = 8 levels). 2. No state corruption: gx_canvas_draw_nesting and _gx_system_current_draw_context are unchanged after overflow. 3. Caller regression (_gx_widget_block_move): does not corrupt nesting counter or context pointer when overflow occurs at max depth. This would fail against the pre-fix code, which called _gx_canvas_drawing_complete() unconditionally. 4. Full unwind: gx_canvas_draw_nesting == 0 and context pointer == NULL after GX_MAX_CONTEXT_NESTING calls to gx_canvas_drawing_complete(). 5. Recovery: a fresh drawing initiate/complete pair succeeds after full unwind. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
No description provided.