Skip to content

Fix crash due to static weak pointer referencing an object in an unloaded DLL#5474

Merged
JohnMcPMS merged 2 commits intomicrosoft:masterfrom
Fulgen301:fix-static-access-violation
May 27, 2025
Merged

Fix crash due to static weak pointer referencing an object in an unloaded DLL#5474
JohnMcPMS merged 2 commits intomicrosoft:masterfrom
Fulgen301:fix-static-access-violation

Conversation

@Fulgen301
Copy link
Contributor

@Fulgen301 Fulgen301 commented May 22, 2025

Based on https://devblogs.microsoft.com/oldnewthing/20210215-00/

Fixes #5363.


Microsoft Reviewers: Open in CodeFlow

@Fulgen301 Fulgen301 requested a review from a team as a code owner May 22, 2025 12:22
@github-actions

This comment was marked as outdated.

@JohnMcPMS
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@JohnMcPMS
Copy link
Member

@Fulgen301 Awesome, thanks for fixing this. I was just turning the corner to work on bug fixes and now there is one fewer on my list.

};

std::weak_ptr<CachedInstalledIndex> m_weak;
winrt::slim_mutex m_lock;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: everything except Get() can go to private: section?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a "private" struct anyway, being declared in the .cpp.

@JohnMcPMS
Copy link
Member

New changes require approval from someone other than JohnMcPMS because they were the last pusher.

Shot myself in the foot by being helpful with the spelling... @yao-msft, could you please help out?

@JohnMcPMS JohnMcPMS merged commit 326558c into microsoft:master May 27, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Access Violation caused by static cache destructor accessing weak references after their module has been unloaded due to COM having been uninitialized

3 participants