Skip to content

Commit 1e89949

Browse files
committed
Keep subscribed TAP available if rollback unadvise fails
1 parent 5e3a2de commit 1e89949

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎Src/StartMenu/StartMenuHelper/Win11StartButtonTap.cpp‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,16 @@ class CWin11StartButtonTap: public IObjectWithSite, public IVisualTreeServiceCal
179179
hr = ActivateLocked();
180180
if (FAILED(hr))
181181
{
182-
// The diagnostics runtime may release this TAP after SetSite fails.
183-
// Do not leave a non-owning global pointer to that object.
184-
std::unique_lock lock(g_TapMutex);
185-
if (g_Tap == this)
186-
g_Tap = NULL;
187-
g_ConnectStarted = false;
182+
// A failed activation without a subscription cannot retain a
183+
// non-owning global TAP pointer. A failed unadvise, however, must
184+
// retain the subscribed callback so activation can be retried.
185+
if (!m_Advised)
186+
{
187+
std::unique_lock lock(g_TapMutex);
188+
if (g_Tap == this)
189+
g_Tap = NULL;
190+
g_ConnectStarted = false;
191+
}
188192
LogToFile(STARTUP_LOG, L"Win11StartButtonTap: activation failed 0x%08X", hr);
189193
}
190194
return hr;

0 commit comments

Comments
 (0)