Skip to content

fix: #179,fix double free uv_handle#183

Closed
thesues wants to merge 2 commits intobytedance:mainfrom
thesues:fix-crash
Closed

fix: #179,fix double free uv_handle#183
thesues wants to merge 2 commits intobytedance:mainfrom
thesues:fix-crash

Conversation

@thesues
Copy link
Collaborator

@thesues thesues commented May 27, 2025

No description provided.

delete client;

if (client) {
client->handle_ = NULL;
Copy link

Choose a reason for hiding this comment

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

what's the point of assigning a member variable right before delete ing its enclosing instance?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

handle_ in Client works like a weak_ptr. this line is to make sure ~Client() will never delete handle_. But this patch has no different from before. #179 is very hard to reproduce. Use this PR as a placeholder.

Copy link

Choose a reason for hiding this comment

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

i see. thanks. just a nit, might want to use nullptr in lieu of NULL in modern C++ code.

@thesues thesues requested a review from lyppg June 11, 2025 23:53
@thesues thesues closed this Jun 12, 2025
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.

3 participants