From 36078b812656c8034f3ea673f3eb4381c0d61c66 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 3 Oct 2024 12:22:09 -0700 Subject: [PATCH] iOS: Fix IOSSurfaceNoopTest (flutter/engine#55621) Previously, we were passing `nullptr` to the `IOSSurfaceNoop` constructor: https://github.com/flutter/engine/blob/56d060d501b5d6bf7d1bf547bdb2bb690e24ca73/shell/platform/darwin/ios/ios_surface_noop.mm#L23-L24 which calls the IOSSurface constructor: https://github.com/flutter/engine/blob/56d060d501b5d6bf7d1bf547bdb2bb690e24ca73/shell/platform/darwin/ios/ios_surface.mm#L55-L58 Which calls `FML_DCHECK(ios_context_)`, which really doesn't like it when `ios_context_` is null. I will later follow up with the next question of... "what exactly is going on with our CI here?", but this unbreaks my local dev testing workflow for the moment :) [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../shell/platform/darwin/ios/ios_surface_noop_unittests.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/ios_surface_noop_unittests.mm b/engine/src/flutter/shell/platform/darwin/ios/ios_surface_noop_unittests.mm index 567026f144..b85dbfedcc 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/ios_surface_noop_unittests.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/ios_surface_noop_unittests.mm @@ -14,6 +14,7 @@ #import "flutter/lib/ui/window/platform_message_response.h" #import "flutter/shell/common/thread_host.h" #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h" +#import "flutter/shell/platform/darwin/ios/ios_context_noop.h" FLUTTER_ASSERT_ARC @@ -22,7 +23,8 @@ FLUTTER_ASSERT_ARC @implementation IOSSurfaceNoopTest - (void)testCreateSurface { - flutter::IOSSurfaceNoop noop(nullptr); + auto context = std::make_shared(); + flutter::IOSSurfaceNoop noop(context); XCTAssertTrue(noop.IsValid()); XCTAssertTrue(!!noop.CreateGPUSurface());