Skip to content

Commit da699b0

Browse files
author
reunion-maestro-bot
committed
Syncing content from committish 08ec1de0f82d16742618784569dcfb69a2c1c99f
1 parent 79404a8 commit da699b0

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

src/dxaml/xcp/dxaml/lib/WindowChrome_Partial.cpp

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
#include "windows.graphics.h"
1313
#include "WindowHelpers.h"
1414
#include "Microsoft.UI.Windowing.h"
15+
#include "FrameworkUdk/Containment.h"
1516

17+
//Bug 57693475: [1.6 Servicing][WASDK][Watson Failure] caused by STOWED_EXCEPTION_80070032_Microsoft.UI.Xaml.dll!DirectUI::WindowChrome::SetTitleBar
18+
#define WINAPPSDK_CHANGEID_57693475 57693475
1619

1720
using namespace DirectUI;
1821
namespace RectHelpers = WindowHelpers::RectHelpers;
@@ -94,16 +97,34 @@ _Check_return_ HRESULT WindowChrome::SetTitleBar(_In_opt_ xaml::IUIElement* titl
9497
ctl::ComPtr<ixp::IAppWindow> appWindow;
9598
IFC_RETURN(GetDesktopWindowNoRef()->get_AppWindowImpl(&appWindow));
9699

97-
if (!appWindow)
100+
if (WinAppSdk::Containment::IsChangeEnabled<WINAPPSDK_CHANGEID_57693475>())
98101
{
99-
// custom titlebar code is being run in a scenario where appwindow is null and thus
100-
// it cannot continue to run. it is running in an unsupported scenario.
101-
// one such scenario is where a top level window is reparented to become a child window of another window
102-
IFCFAILFAST(E_NOTSUPPORTED);
102+
// SetTitleBar gets called with titleBar as nullptr during window close operations
103+
// If the window is not a top level window, we should not failfast here
104+
if (!appWindow && titleBar)
105+
{
106+
// custom titlebar code is being run in a scenario where appwindow is null and thus
107+
// it cannot continue to run. it is running in an unsupported scenario.
108+
// one such scenario is where a top level window is reparented to become a child window of another window
109+
IFCFAILFAST(E_NOTSUPPORTED);
110+
}
111+
}
112+
else
113+
{
114+
if (!appWindow)
115+
{
116+
// custom titlebar code is being run in a scenario where appwindow is null and thus
117+
// it cannot continue to run. it is running in an unsupported scenario.
118+
// one such scenario is where a top level window is reparented to become a child window of another window
119+
IFCFAILFAST(E_NOTSUPPORTED);
120+
}
121+
}
122+
if (appWindow)
123+
{
124+
IFC_RETURN(appWindow->get_Id(&windowId));
125+
126+
IFC_RETURN(inputNonClientPtrSrcStatics->GetForWindowId(windowId, &m_inputNonClientPtrSrc));
103127
}
104-
IFC_RETURN(appWindow->get_Id(&windowId));
105-
106-
IFC_RETURN(inputNonClientPtrSrcStatics->GetForWindowId(windowId, &m_inputNonClientPtrSrc));
107128
}
108129

109130
//detach everything from existing titlebar

0 commit comments

Comments
 (0)