Fix parameter type in FlutterDesktopEngineCreate (flutter/engine#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 https://github.com/flutter/flutter/issues/75465
This commit is contained in:
@@ -30,7 +30,7 @@ FlutterEngine::FlutterEngine(const DartProject& project) {
|
||||
c_engine_properties.dart_entrypoint_argv =
|
||||
entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr;
|
||||
|
||||
engine_ = FlutterDesktopEngineCreate(c_engine_properties);
|
||||
engine_ = FlutterDesktopEngineCreate(&c_engine_properties);
|
||||
|
||||
auto core_messenger = FlutterDesktopEngineGetMessenger(engine_);
|
||||
messenger_ = std::make_unique<BinaryMessengerImpl>(core_messenger);
|
||||
|
||||
@@ -82,9 +82,9 @@ bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
|
||||
}
|
||||
|
||||
FlutterDesktopEngineRef FlutterDesktopEngineCreate(
|
||||
const FlutterDesktopEngineProperties& engine_properties) {
|
||||
const FlutterDesktopEngineProperties* engine_properties) {
|
||||
if (s_stub_implementation) {
|
||||
return s_stub_implementation->EngineCreate(engine_properties);
|
||||
return s_stub_implementation->EngineCreate(*engine_properties);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ void FlutterDesktopViewControllerForceRedraw(
|
||||
}
|
||||
|
||||
FlutterDesktopEngineRef FlutterDesktopEngineCreate(
|
||||
const FlutterDesktopEngineProperties& engine_properties) {
|
||||
flutter::FlutterProjectBundle project(engine_properties);
|
||||
const FlutterDesktopEngineProperties* engine_properties) {
|
||||
flutter::FlutterProjectBundle project(*engine_properties);
|
||||
auto engine = std::make_unique<flutter::FlutterWindowsEngine>(project);
|
||||
return HandleForEngine(engine.release());
|
||||
}
|
||||
|
||||
@@ -131,9 +131,10 @@ FLUTTER_EXPORT bool FlutterDesktopViewControllerHandleTopLevelWindowProc(
|
||||
// Creates a Flutter engine with the given properties.
|
||||
//
|
||||
// The caller owns the returned reference, and is responsible for calling
|
||||
// FlutterDesktopEngineDestroy.
|
||||
// FlutterDesktopEngineDestroy. The lifetime of |engine_properties| is required
|
||||
// to extend only until the end of this call.
|
||||
FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopEngineCreate(
|
||||
const FlutterDesktopEngineProperties& engine_properties);
|
||||
const FlutterDesktopEngineProperties* engine_properties);
|
||||
|
||||
// Shuts down and destroys the given engine instance. Returns true if the
|
||||
// shutdown was successful, or if the engine was not running.
|
||||
|
||||
Reference in New Issue
Block a user