wails icon indicating copy to clipboard operation
wails copied to clipboard

v2.9.1 runtime.OpenFileDialog in win10/win11 will crash

Open scp-66 opened this issue 6 months ago • 6 comments

Description

func (a *App) Upload(sid uint32, dst string) error {
	return control.Upload(a.ctx, sid, dst)
}

func Upload(ctx context.Context, sid uint32, dst string) error {
	home, err := os.UserHomeDir()
	if err != nil {
		return err
	}
	uploadOptions := runtime.OpenDialogOptions{
		Title:            "Upload File",
		DefaultDirectory: filepath.Join(home, "Desktop"),
	}
	fmt.Println(filepath.Join(home, "Desktop"))
	src, _ := runtime.OpenFileDialog(ctx, uploadOptions)
	...
}

This is my code.It will crash at runtime.OpenFileDialog.

To Reproduce

1.call this function by click. 2.the app crashed.

Expected behaviour

Open a file dialog to select a file.

Screenshots

No response

Attempted Fixes

I'm sure my DefaultDirectory is existed.Then I delete all of runtime.OpenDialogOptions.But It's still crashed

System Details

Version | v2.9.1

# System
┌─────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Windows 10 Pro                                                           |
| Version      | 2009 (Build: 22631)                                                      |
| ID           | 23H2                                                                     |
| Go Version   | go1.23.0                                                                 |
| Platform     | windows                                                                  |
| Architecture | amd64                                                                    |
| CPU          | 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz                           |
| GPU 1        | Intel(R) Iris(R) Xe Graphics (Intel Corporation) - Driver: 32.0.101.5768 |
| GPU 2        | Microsoft Remote Display Adapter (Microsoft) - Driver: 10.0.22621.3672   |
| Memory       | 32GB                                                                     |
└─────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version        |
| WebView2   | N/A          | Installed | 127.0.2651.105 |
| Nodejs     | N/A          | Installed | 20.16.0        |
| npm        | N/A          | Installed | 10.2.3         |
| *upx       | N/A          | Available |                |
| *nsis      | N/A          | Available |                |
└─────────────── * - Optional Dependency ────────────────┘

Additional context

No response

scp-66 avatar Aug 22 '24 06:08 scp-66