File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,8 +200,17 @@ static void handle_geometry_changed(FlView* self) {
200200 self->engine , allocation.width * scale_factor,
201201 allocation.height * scale_factor, scale_factor);
202202
203- fl_renderer_wait_for_frame (self->renderer , allocation.width * scale_factor,
204- allocation.height * scale_factor);
203+ // Make sure the view has been realized and its size has been allocated before
204+ // waiting for a frame. `fl_view_realize()` and `fl_view_size_allocate()` may
205+ // be called in either order depending on the order in which the window is
206+ // shown and the view is added to a container in the app runner.
207+ //
208+ // Note: `gtk_widget_init()` initializes the size allocation to 1x1.
209+ if (allocation.width > 1 && allocation.height > 1 &&
210+ gtk_widget_get_realized (GTK_WIDGET (self))) {
211+ fl_renderer_wait_for_frame (self->renderer , allocation.width * scale_factor,
212+ allocation.height * scale_factor);
213+ }
205214}
206215
207216// Adds a widget to render in this view.
@@ -661,6 +670,8 @@ static void fl_view_realize(GtkWidget* widget) {
661670 g_warning (" Failed to start Flutter engine: %s" , error->message );
662671 return ;
663672 }
673+
674+ handle_geometry_changed (self);
664675}
665676
666677// Implements GtkWidget::get-preferred-width
You can’t perform that action at this time.
0 commit comments