Skip to content

fix(windows): dangling pointer when remove_for_hwnd called before drop#363

Merged
Legend-Master merged 1 commit into
devfrom
windows-dangling-pointer
Jun 17, 2026
Merged

fix(windows): dangling pointer when remove_for_hwnd called before drop#363
Legend-Master merged 1 commit into
devfrom
windows-dangling-pointer

Conversation

@Legend-Master

@Legend-Master Legend-Master commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Fix tauri-apps/tauri#15523

Spent so much time tracking this one down, the problem in tauri-apps/tauri#15523 was not that the menu getting accessed off main thread but simply the drop orders

A simpler reproduction tauri code is just

{
    let _ = window.remove_menu().unwrap();
}
{
    let _ = window
        .set_menu(tauri::menu::Menu::default(&app_handle).unwrap())
        .unwrap();
}

The problem here is that we didn't clean up the window subclass when removing the menu (the drop didn't clean it up because the tracking hwnd is removed by remove_for_hwnd) and also we didn't refresh it in time that we called SetMenu before SetWindowSubclass in init_for_hwnd_with_theme, and SetMenu triggered menu_subclass_proc which contains the stale Menu pointer


sorry about the push to dev branch by accident

@github-actions

Copy link
Copy Markdown
Contributor

Package Changes Through de615bc

There are 1 changes which include muda with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
muda 0.19.2 0.19.3

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Legend-Master Legend-Master merged commit 73106f5 into dev Jun 17, 2026
13 checks passed
@Legend-Master Legend-Master deleted the windows-dangling-pointer branch June 17, 2026 07:54
"muda": patch
---

On Windows, fixed a bug that would truncate menubar items text to ~10 characters in dark-mode.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I swear I wrote the change file and it didn't look like this 🤦‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants