Acquire context reference at the correct time for FlGlArea. (flutter/engine#29791)

This is a reland of flutter/engine#29178 onto the main branch. The
original patch was landed on the master branch during the branch switch
from master to main.
This commit is contained in:
Chris Bracken 2021-11-17 11:04:33 -08:00 committed by GitHub
parent baab0c1ca8
commit dd669f3631
2 changed files with 1 additions and 2 deletions

View File

@ -118,7 +118,7 @@ GtkWidget* fl_gl_area_new(GdkGLContext* context) {
g_return_val_if_fail(GDK_IS_GL_CONTEXT(context), nullptr);
FlGLArea* area =
reinterpret_cast<FlGLArea*>(g_object_new(fl_gl_area_get_type(), nullptr));
area->context = context;
area->context = GDK_GL_CONTEXT(g_object_ref(context));
return GTK_WIDGET(area);
}

View File

@ -103,7 +103,6 @@ static gboolean fl_renderer_gl_present_layers(FlRenderer* renderer,
case kFlutterLayerContentTypeBackingStore: {
const FlutterBackingStore* backing_store = layer->backing_store;
auto framebuffer = &backing_store->open_gl.framebuffer;
g_object_ref(context);
fl_view_add_gl_area(
view, context,
reinterpret_cast<FlBackingStoreProvider*>(framebuffer->user_data));