mirror of
https://github.com/microsoft/terminal.git
synced 2026-02-03 18:17:40 -06:00
Prevent RPC_E_CANTCALLOUT_ININPUTSYNCCALL during WM_SETTINGCHANGE (#19755)
Closes #19505
This commit is contained in:
parent
0ee3cfb3fd
commit
e8971c80ae
2
.github/actions/spelling/expect/expect.txt
vendored
2
.github/actions/spelling/expect/expect.txt
vendored
@ -141,6 +141,7 @@ BValue
|
||||
Cacafire
|
||||
CALLCONV
|
||||
CANDRABINDU
|
||||
CANTCALLOUT
|
||||
capslock
|
||||
CARETBLINKINGENABLED
|
||||
CARRIAGERETURN
|
||||
@ -808,6 +809,7 @@ INCONTEXT
|
||||
INDEXID
|
||||
INFOEX
|
||||
inheritcursor
|
||||
ININPUTSYNCCALL
|
||||
INITCOMMONCONTROLSEX
|
||||
INITDIALOG
|
||||
INITGUID
|
||||
|
||||
@ -149,7 +149,9 @@ namespace winrt::TerminalApp::implementation
|
||||
});
|
||||
|
||||
_languageProfileNotifier = winrt::make_self<LanguageProfileNotifier>([this]() {
|
||||
_reloadSettings->Run();
|
||||
// TODO: This is really bad, because we reset any current user customizations.
|
||||
// See GH#11522.
|
||||
ReloadSettingsThrottled();
|
||||
});
|
||||
|
||||
// Do this here, rather than at the top of main. This will prevent us from
|
||||
@ -329,7 +331,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
if (modifiedBasename == settingsBasename)
|
||||
{
|
||||
_reloadSettings->Run();
|
||||
ReloadSettingsThrottled();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -435,6 +437,11 @@ namespace winrt::TerminalApp::implementation
|
||||
SettingsChanged.raise(*this, *ev);
|
||||
}
|
||||
|
||||
void AppLogic::ReloadSettingsThrottled()
|
||||
{
|
||||
_reloadSettings->Run();
|
||||
}
|
||||
|
||||
// This is a continuation of AppLogic::Create() and includes the more expensive parts.
|
||||
void AppLogic::NotifyRootInitialized()
|
||||
{
|
||||
|
||||
@ -36,6 +36,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool IsRunningElevated() const noexcept;
|
||||
bool CanDragDrop() const noexcept;
|
||||
void ReloadSettings();
|
||||
void ReloadSettingsThrottled();
|
||||
void NotifyRootInitialized();
|
||||
|
||||
bool HasSettingsStartupActions() const noexcept;
|
||||
@ -80,7 +81,6 @@ namespace winrt::TerminalApp::implementation
|
||||
[[nodiscard]] HRESULT _TryLoadSettings() noexcept;
|
||||
void _ProcessLazySettingsChanges();
|
||||
void _RegisterSettingsChange();
|
||||
safe_void_coroutine _DispatchReloadSettings();
|
||||
|
||||
void _setupFolderPathEnvVar();
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ namespace TerminalApp
|
||||
Boolean HasSettingsStartupActions();
|
||||
|
||||
void ReloadSettings();
|
||||
void ReloadSettingsThrottled();
|
||||
Microsoft.Terminal.Settings.Model.CascadiaSettings Settings { get; };
|
||||
|
||||
TerminalWindow CreateNewWindow();
|
||||
|
||||
@ -994,7 +994,13 @@ LRESULT WindowEmperor::_messageHandler(HWND window, UINT const message, WPARAM c
|
||||
if (isCurrentlyDark != _currentSystemThemeIsDark)
|
||||
{
|
||||
_currentSystemThemeIsDark = isCurrentlyDark;
|
||||
_app.Logic().ReloadSettings();
|
||||
|
||||
// GH#19505: WM_SETTINGCHANGE gets sent out with a SendMessage() call, which means
|
||||
// that COM methods marked as [input_sync] cannot be called. Well, our CascadiaSettings
|
||||
// loader does call such methods. This results in RPC_E_CANTCALLOUT_ININPUTSYNCCALL, aka:
|
||||
// "An outgoing call cannot be made since the application is dispatching an input-synchronous call."
|
||||
// The solution is to simply do it in another tick.
|
||||
_app.Logic().ReloadSettingsThrottled();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user