From 9327ec1d5cbd210279a88ae955d4cd69a22e6912 Mon Sep 17 00:00:00 2001 From: James Clarke Date: Sat, 10 Apr 2021 18:29:06 -0700 Subject: [PATCH] Fix interface copying so that it works --- .../windows/flutter_windows_winuwp.cc | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/shell/platform/windows/flutter_windows_winuwp.cc b/shell/platform/windows/flutter_windows_winuwp.cc index b2eac271fce1b..99e826fdc9f78 100644 --- a/shell/platform/windows/flutter_windows_winuwp.cc +++ b/shell/platform/windows/flutter_windows_winuwp.cc @@ -57,17 +57,26 @@ FlutterDesktopViewControllerCreateFromCoreWindow( std::unique_ptr(EngineFromHandle(engine))); state->view->CreateRenderSurface(); - winrt::Windows::ApplicationModel::Activation::LaunchActivatedEventArgs + winrt::Windows::ApplicationModel::Activation::IActivatedEventArgs arg_interface{nullptr}; winrt::copy_from_abi(arg_interface, args); std::vector engine_switches; - - if (arg_interface != nullptr) { - std::string launchargs = winrt::to_string(arg_interface.Arguments()); - if (!launchargs.empty()) { - engine_switches = split(launchargs); - } + winrt::Windows::ApplicationModel::Activation::LaunchActivatedEventArgs launch{ + nullptr}; + switch (arg_interface.Kind()) { + case winrt::Windows::ApplicationModel::Activation::ActivationKind::Launch: + launch = arg_interface.as(); + if (launch != nullptr) { + std::string launchargs = winrt::to_string(launch.Arguments()); + if (!launchargs.empty()) { + engine_switches = split(launchargs); + } + } + break; + default: + break; } state->view->GetEngine()->SetSwitches(engine_switches);