@@ -161,6 +161,8 @@ namespace winrt::YtFlowApp::implementation
161161 }
162162 auto const navArgs{args};
163163 auto const lifetime{get_strong ()};
164+ co_await SaveProfileName ();
165+
164166 if (std::exchange (m_forceQuit, false ))
165167 {
166168 co_return ;
@@ -174,7 +176,7 @@ namespace winrt::YtFlowApp::implementation
174176 unsavedPluginNames = unsavedPluginNames + L" \r\n " + model->Plugin ().Name ();
175177 }
176178 }
177- if (unsavedPluginNames == L" " )
179+ if (unsavedPluginNames. empty () )
178180 {
179181 co_return ;
180182 }
@@ -259,12 +261,17 @@ namespace winrt::YtFlowApp::implementation
259261 }
260262 }
261263
262- fire_and_forget EditProfilePage::SaveProfileName ()
264+ IAsyncAction EditProfilePage::SaveProfileName ()
263265 {
264266 try
265267 {
266- const auto profile{m_profile};
267- const auto newProfileName{ProfileNameBox ().Text ()};
268+ auto const lifetime{get_strong ()};
269+ auto const profile{m_profile};
270+ auto const newProfileName{ProfileNameBox ().Text ()};
271+ if (!profile)
272+ {
273+ co_return ;
274+ }
268275 if (profile->Name () == newProfileName)
269276 {
270277 co_return ;
@@ -275,6 +282,9 @@ namespace winrt::YtFlowApp::implementation
275282 auto conn{FfiDbInstance.Connect ()};
276283 conn.UpdateProfile (profile->Id (), winrt::to_string (newProfileName).data (),
277284 winrt::to_string (profile->Locale ()).data ());
285+
286+ co_await resume_foreground (lifetime->Dispatcher ());
287+ profile->Name (newProfileName);
278288 }
279289 catch (...)
280290 {
0 commit comments