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

Drag window onto original monitor after plugging in a monitor causes a crash #3121

Open
1 of 11 tasks
venning opened this issue Sep 30, 2024 · 0 comments
Open
1 of 11 tasks

Comments

@venning
Copy link

venning commented Sep 30, 2024

Ebitengine Version

v2.8.0

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

Go Version (go version)

go version go1.23.0 darwin/arm64

What steps will reproduce the problem?

This may be a little specific to my case, but it is 100% reproducible for me:

  • Start game on laptop with no external monitors plugged in.
  • Plug in external monitor.
    • The OS now uses both monitors, separately (not mirrored).
    • This may be important: the external monitor is my "primary monitor" for the OS. This is necessary due to other games (such as Hades) refusing to re-scale the game when dragged between monitors. As such, I assume other people have done this.
    • Because the external monitor is my primary monitor, the game window (and terminal) are moved onto the new external monitor automatically.
  • Attempt to drag the window back to the original laptop screen.
  • As soon as the cursor enters the laptop screen while dragging, the game crashes.

What is the expected result?

Successfully moving the game window.

What happens instead?

The following crash output:

glfw: Cocoa: Cannot query content scale without screen: a platform-specific error occurred
panic: ebiten: width at NewImage must be positive but 0

goroutine 4 [running]:
github.com/hajimehoshi/ebiten/v2.newImage({{0x0?, 0x10097c9e8?}, {0x1400055bc78?, 0x1007a0878?}}, 0x14000401e30?)
	/Users/chris/go/pkg/mod/github.com/hajimehoshi/ebiten/[email protected]/image.go:1221 +0x2b0
github.com/hajimehoshi/ebiten/v2.(*gameForUI).NewScreenImage(0x1400038eb60, 0x0?, 0x0?)
	/Users/chris/go/pkg/mod/github.com/hajimehoshi/ebiten/[email protected]/gameforui.go:83 +0x88
github.com/hajimehoshi/ebiten/v2/internal/ui.(*context).layoutGame(0x140006dc580, 0x4084000000000000, 0x407e000000000000, 0x7ff8000000000000)
	/Users/chris/go/pkg/mod/github.com/hajimehoshi/ebiten/[email protected]/internal/ui/context.go:288 +0x12c
github.com/hajimehoshi/ebiten/v2/internal/ui.(*context).updateFrameImpl(0x140006dc580, {0x100984d78, 0x140006e2300}, 0x1, 0x4084000000000000, 0x407e000000000000, 0x7ff8000000000000, 0x14000312308, 0x0)
	/Users/chris/go/pkg/mod/github.com/hajimehoshi/ebiten/[email protected]/internal/ui/context.go:128 +0xe8
github.com/hajimehoshi/ebiten/v2/internal/ui.(*context).updateFrame(0x140006dc580, {0x100984d78, 0x140006e2300}, 0x4084000000000000, 0x407e000000000000, 0x7ff8000000000000, 0x14000312308)
	/Users/chris/go/pkg/mod/github.com/hajimehoshi/ebiten/[email protected]/internal/ui/context.go:73 +0x60
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).updateGame(0x14000312308)
	/Users/chris/go/pkg/mod/github.com/hajimehoshi/ebiten/[email protected]/internal/ui/ui_glfw.go:1491 +0x178
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).loopGame(0x14000312308)
	/Users/chris/go/pkg/mod/github.com/hajimehoshi/ebiten/[email protected]/internal/ui/ui_glfw.go:1448 +0x94
github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).runMultiThread.func2()
	/Users/chris/go/pkg/mod/github.com/hajimehoshi/ebiten/[email protected]/internal/ui/run.go:71 +0x134
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/Users/chris/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78 +0x54
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
	/Users/chris/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x98
exit status 2

Anything else you feel useful to add?

I did use ebiten.Monitor() to determine that Ebitengine does successfully list the correct monitor when the external monitor is plugged in.


MacBook Pro, 14-inch, 2021
Apple M1 Pro
Ventura 13.1

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

Successfully merging a pull request may close this issue.

2 participants