Skip to content

Commit d338154

Browse files
authored
Fix parameter type in FlutterDesktopEngineCreate (flutter#25439)
FlutterDesktopEngineCreate is part of our C API. We were using a C++ reference type instead of a C-compatible pointer type. This is a breaking change to anyone calling this directly; we believe this should affect few people because the Windows template only uses the `FlutterEngine` wrapper in `shell/platform/windows/client_wrapper/include/flutter/flutter_engine.h`. Fixes flutter#75465
1 parent d404729 commit d338154

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

shell/platform/windows/client_wrapper/flutter_engine.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ FlutterEngine::FlutterEngine(const DartProject& project) {
3030
c_engine_properties.dart_entrypoint_argv =
3131
entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr;
3232

33-
engine_ = FlutterDesktopEngineCreate(c_engine_properties);
33+
engine_ = FlutterDesktopEngineCreate(&c_engine_properties);
3434

3535
auto core_messenger = FlutterDesktopEngineGetMessenger(engine_);
3636
messenger_ = std::make_unique<BinaryMessengerImpl>(core_messenger);

shell/platform/windows/client_wrapper/testing/stub_flutter_windows_api.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
8282
}
8383

8484
FlutterDesktopEngineRef FlutterDesktopEngineCreate(
85-
const FlutterDesktopEngineProperties& engine_properties) {
85+
const FlutterDesktopEngineProperties* engine_properties) {
8686
if (s_stub_implementation) {
87-
return s_stub_implementation->EngineCreate(engine_properties);
87+
return s_stub_implementation->EngineCreate(*engine_properties);
8888
}
8989
return nullptr;
9090
}

shell/platform/windows/flutter_windows.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ void FlutterDesktopViewControllerForceRedraw(
8282
}
8383

8484
FlutterDesktopEngineRef FlutterDesktopEngineCreate(
85-
const FlutterDesktopEngineProperties& engine_properties) {
86-
flutter::FlutterProjectBundle project(engine_properties);
85+
const FlutterDesktopEngineProperties* engine_properties) {
86+
flutter::FlutterProjectBundle project(*engine_properties);
8787
auto engine = std::make_unique<flutter::FlutterWindowsEngine>(project);
8888
return HandleForEngine(engine.release());
8989
}

shell/platform/windows/public/flutter_windows.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,10 @@ FLUTTER_EXPORT bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
131131
// Creates a Flutter engine with the given properties.
132132
//
133133
// The caller owns the returned reference, and is responsible for calling
134-
// FlutterDesktopEngineDestroy.
134+
// FlutterDesktopEngineDestroy. The lifetime of |engine_properties| is required
135+
// to extend only until the end of this call.
135136
FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopEngineCreate(
136-
const FlutterDesktopEngineProperties& engine_properties);
137+
const FlutterDesktopEngineProperties* engine_properties);
137138

138139
// Shuts down and destroys the given engine instance. Returns true if the
139140
// shutdown was successful, or if the engine was not running.

0 commit comments

Comments
 (0)