Skip to content

Crashes when setting as default browser (Windows 11) #586

Description

@convertted

What happened?

It crashes when I click set as default browser in the settings.

There is nothing in the logs that show what happened, it just shows it checked for updates. I've triple checked the logs to make sure.

Steps to reproduce

  1. Open Settings
  2. Click Set as default Browser
  3. Crashes

Operating System

Windows

Donut Browser version

0.29.6

Wayfern version

unknown

Error logs or screenshots

2026-08-25.19-15-47.mp4

I am not familiar with Rust (or creating Windows Programs), so I gave Gemini the git folder and let it go to work, I didn't want to provide the actual "fixed" code in a PR because i'm sure its not great workaround or up to any decent standards. But I can share them if you are interested. These fixes allowed me to build a new setup exe, and I am able to set it as default browser and works as expected after applying these fixes.

  1. Fixed Application Crash on Setting Default Browser
    In src-tauri/src/default_browser.rs
  • Removed SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, ...): The previous implementation passed a local-process string pointer across all Windows processes and WebView2 message pumps, which caused access violations / abrupt process crashes when broadcasting.
  • Replaced with SHChangeNotify: Used standard Win32 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, null, null) from shell32.dll, which safely invalidates the shell's association cache without cross-process memory hazards.
  • Removed direct UserChoice registry writing: Modern Windows forbids unhashed direct writes to UserChoice. Setting default browser now opens Windows Settings (ms-settings:defaultapps?registeredAppMachineName=DonutBrowser) for smooth, official association.
  1. Implemented Complete Windows Browser Registration (StartMenuInternet)
    In src-tauri/src/default_browser.rs:
  • Registered Software\Clients\StartMenuInternet\DonutBrowser with full capabilities (URLAssociations for http, https, ftp; FileAssociations for .htm, .html, .shtml, .xhtml, etc.; InstallInfo, DefaultIcon, and shell\open\command).
  • Updated Software\RegisteredApplications to point to Software\Clients\StartMenuInternet\DonutBrowser\Capabilities.
  • Registered ProgIDs DonutBrowserHTML and DonutBrowser.HTML with Application metadata and command handlers.
  • Registered application entries under Software\Classes\Applications and OpenWithProgids so Donut Browser shows up in Windows "Default apps" and "Open With" dialogs.
  • Added best-effort HKLM registration when elevated.
  1. Added Auto-Registration on Startup & URL Argument Forwarding
    In src-tauri/src/lib.rs
  • Added startup hook calling default_browser::register_windows_browser_app() so Windows immediately detects Donut Browser upon launch.
  • Enhanced tauri_plugin_single_instance to parse URL and file arguments passed to secondary instances and forward them to handle_url_open instead of silently dropping them.
  • Sanitized argument parsing in run_with_builder to properly trim surrounding quotes.

Verification

  • Checked registry key structure against Windows Default Programs specifications.
  • Verified single-instance and startup URL lifecycle deduplication.

Did you use AI to write this report?

Yes, AI helped me write this

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions