Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wails app crash when Frameless attribute is use in two apps in a row on Linux #3425

Closed
daciot opened this issue Apr 25, 2024 · 1 comment
Closed
Labels
Bug Something isn't working

Comments

@daciot
Copy link

daciot commented Apr 25, 2024

Description

Warning: This is an intermittent bug that sometimes works well and sometimes does not.

The application only crashes on Linux when I create two applications in a row (the second one only starts after the first one is closed). I've noticed that this behavior occurs when I configure the attributes. Frameless and Linux like the code below

func main() {
        
        app := NewApp()
    
        err := wails.Run(&options.App{
	        Title:     "First Window",
	        Frameless: true,
	        OnDomReady: func(ctx context.Context) {
		        runtime.Quit(ctx)
	        },
	        AssetServer: &assetserver.Options{
		        Assets: assets,
	        },
	        BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
	        Bind: []interface{}{
		        app,
	        },
	        Linux: &linux.Options{
		        WebviewGpuPolicy: linux.WebviewGpuPolicyNever,
	        },
        })
    
        if err != nil {
	        println("Error:", err.Error())
        }
    
        err = wails.Run(&options.App{
    
	        Title:     "2nd Window",
	        Frameless: false,
	        AssetServer: &assetserver.Options{
		        Assets: assets,
	        },
	        BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
	        Bind: []interface{}{
		        app,
	        },
	        Linux: &linux.Options{
		        WebviewGpuPolicy: linux.WebviewGpuPolicyNever,
	        },
        })
    
        if err != nil {
	        println("Error:", err.Error())
        }
     }

To Reproduce

  1. Create a simple wails app using the command "wails init -n myproject -t react"

  2. Replace the function main inside main.go for the follow code

     func main() {
         
         app := NewApp()
     
         err := wails.Run(&options.App{
             Title:     "First Window",
             Frameless: true,
             OnDomReady: func(ctx context.Context) {
     	        runtime.Quit(ctx)
             },
             AssetServer: &assetserver.Options{
     	        Assets: assets,
             },
             BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
             Bind: []interface{}{
     	        app,
             },
             Linux: &linux.Options{
     	        WebviewGpuPolicy: linux.WebviewGpuPolicyNever,
             },
         })
     
         if err != nil {
             println("Error:", err.Error())
         }
     
         err = wails.Run(&options.App{
     
             Title:     "2nd Window",
             Frameless: false,
             AssetServer: &assetserver.Options{
     	        Assets: assets,
             },
             BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
             Bind: []interface{}{
     	        app,
             },
             Linux: &linux.Options{
     	        WebviewGpuPolicy: linux.WebviewGpuPolicyNever,
             },
         })
     
         if err != nil {
             println("Error:", err.Error())
         }
      }
    
  3. Run wails build

  4. Run the file created in step 3 from the 'myproject/build/bin' directory

  5. If the problem does not occur, repeat step 4 (the bug is intermittent)

Expected behaviour

The application should open without any errors.

Screenshots

Error

image

Attempted Fixes

No response

System Details

# Wails
Version         | v2.8.1
Package Manager | apt   

# System
┌──────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                    |
| Version      | 22.04                                     |
| ID           | ubuntu                                    |
| Go Version   | go1.22.2                                  |
| Platform     | linux                                     |
| Architecture | amd64                                     |
| CPU          | Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz  |
| GPU          | SVGA II Adapter (VMware) - Driver: vmwgfx |
| Memory       | 24GB                                      |
└──────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Available | 24.0.5-0ubuntu1~22.04.1 |
| gcc        | build-essential       | Installed | 12.9ubuntu3             |
| libgtk-3   | libgtk-3-dev          | Available | 3.24.33-1ubuntu2        |
| libwebkit  | libwebkit2gtk-4.0-dev | Available | 2.44.0-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.5.0                  |
| *nsis      | nsis                  | Available | 3.08-2                  |
| pkg-config | pkg-config            | Installed | 0.29.2                  |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

# Diagnosis
Required package(s) installation details: 
  - libgtk-3: sudo apt install libgtk-3-dev
  - libwebkit: sudo apt install libwebkit2gtk-4.0-dev

Optional package(s) installation details: 
  - docker: sudo apt install docker.io
  - nsis: sudo apt install nsis

 WARNING  Your system has missing dependencies!

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

Additional context

I put the logs here
wails.logs.txt

@daciot daciot added the Bug Something isn't working label Apr 25, 2024
@leaanthony
Copy link
Member

Hi there 👍 We don't support calling Run() multiple times or multiple windows this way, however it's coming in v3 which you're welcome to test: https://v3alpha.wails.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants