Skip to content

[Linux] Move Flutter rendering into a new FlViewRenderer widget#188289

Merged
robert-ancell merged 1 commit into
flutter:masterfrom
robert-ancell:refactor-linux-view-renderer
Jun 24, 2026
Merged

[Linux] Move Flutter rendering into a new FlViewRenderer widget#188289
robert-ancell merged 1 commit into
flutter:masterfrom
robert-ancell:refactor-linux-view-renderer

Conversation

@robert-ancell

Copy link
Copy Markdown
Contributor

Extracts the GtkDrawingArea and all Flutter rendering responsibilities out of FlView into a new FlViewRenderer widget. FlViewRenderer owns the compositor, OpenGL context and background color, and performs the frame drawing. FlView retains input handling, accessibility, geometry and engine lifecycle, delegating rendering to the new widget.

This reduces the complexity of FlView, but is mostly motivated by wanting to add a subsurface renderer, which will either add functionality to FlViewRenderer or we will have multiple renderer widgets.

@robert-ancell
robert-ancell requested a review from a team as a code owner June 22, 2026 00:40
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 22, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@robert-ancell
robert-ancell requested a review from mattkae June 22, 2026 00:41
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically a: desktop Running on desktop team-linux Owned by the Linux platform team labels Jun 22, 2026
@google-cla

google-cla Bot commented Jun 22, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Linux platform shell by introducing a new FlViewRenderer widget to encapsulate the rendering logic previously handled directly by FlView. The review feedback identifies several potential null pointer dereferences in fl_view_renderer.cc where self->compositor or color could be null, which could lead to crashes during redraw, drawing, layer presentation, or background color updates.

Comment thread engine/src/flutter/shell/platform/linux/fl_view_renderer.cc
Comment thread engine/src/flutter/shell/platform/linux/fl_view_renderer.cc
Comment thread engine/src/flutter/shell/platform/linux/fl_view_renderer.cc
Comment thread engine/src/flutter/shell/platform/linux/fl_view_renderer.cc
mattkae
mattkae previously approved these changes Jun 22, 2026

@mattkae mattkae left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable refactor 👍

Comment thread engine/src/flutter/shell/platform/linux/fl_view_renderer.cc
Extracts the GtkDrawingArea and all Flutter rendering responsibilities
out of FlView into a new FlViewRenderer widget. FlViewRenderer owns the
compositor, OpenGL context and background color, and performs the frame
drawing. FlView retains input handling, accessibility, geometry and
engine lifecycle, delegating rendering to the new widget.
@robert-ancell
robert-ancell force-pushed the refactor-linux-view-renderer branch from 4143b60 to 8027cce Compare June 22, 2026 23:45
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 22, 2026
@robert-ancell

Copy link
Copy Markdown
Contributor Author

Rebased and force-pushed to avoid confusing the cla checker.

@robert-ancell
robert-ancell requested a review from mattkae June 22, 2026 23:46
@robert-ancell robert-ancell added the CICD Run CI/CD label Jun 22, 2026
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
…ter#188289)

Extracts the GtkDrawingArea and all Flutter rendering responsibilities
out of FlView into a new FlViewRenderer widget. FlViewRenderer owns the
compositor, OpenGL context and background color, and performs the frame
drawing. FlView retains input handling, accessibility, geometry and
engine lifecycle, delegating rendering to the new widget.

This reduces the complexity of FlView, but is mostly motivated by
wanting to add a subsurface renderer, which will either add
functionality to FlViewRenderer or we will have multiple renderer
widgets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically team-linux Owned by the Linux platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants