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

internal/ui: crash by dropping an HTML element onto the canvas #3043

Closed
1 of 11 tasks
cowboymacke opened this issue Jul 17, 2024 · 2 comments
Closed
1 of 11 tasks

internal/ui: crash by dropping an HTML element onto the canvas #3043

cowboymacke opened this issue Jul 17, 2024 · 2 comments
Milestone

Comments

@cowboymacke
Copy link
Contributor

Ebitengine Version

v2.7.5

Operating System

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

Go Version (go version)

go1.22.3 darwin/arm64

What steps will reproduce the problem?

Problem happens you object are drag from the web view into the canvas/iframe,

Follow example on https://ebitengine.org/en/documents/webassembly.html

  1. add image into your simple index.html
<!DOCTYPE html>
<iframe src="main.html" width="640" height="480"></iframe>
<img src="https://ebitengine.org/images/logo.png">
  1. Run using favorite web-server
  2. drag and drop image into the iframe
Screen.Recording.2024-07-17.at.16.44.16.mov

What is the expected result?

Not to crash the engine

What happens instead?

Engine crash with following console output

goroutine 630 [running]:
wasm_exec.js:22 syscall/js.Value.Get({{}, 0x7ff8000000000002, 0x0}, {0x131fad, 0xa})
wasm_exec.js:22     /opt/homebrew/Cellar/go/1.22.3/libexec/src/syscall/js/js.go:290 +0xc
wasm_exec.js:22 github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).appendDroppedFiles(0x1cb0248, {{}, 0x7ff8000100002292, 0x284a878})
wasm_exec.js:22     /Users/ling/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.7.5/internal/ui/ui_js.go:713 +0xa
wasm_exec.js:22 created by github.com/hajimehoshi/ebiten/v2/internal/ui.(*UserInterface).setCanvasEventHandlers.func13 in goroutine 12
wasm_exec.js:22     /Users/ling/go/pkg/mod/github.com/hajimehoshi/ebiten/v2@v2.7.5/internal/ui/ui_js.go:693 +0xa

Anything else you feel useful to add?

Only been verified on safari and chrome

@github-actions github-actions bot added the os:js label Jul 17, 2024
@hajimehoshi hajimehoshi added this to the v2.7.8 milestone Jul 17, 2024
@hajimehoshi
Copy link
Owner

The point is

panic: syscall/js: call of Value.Get on null

there.

@hajimehoshi
Copy link
Owner

As we discussed in the Discord server, I'm waiting for @cowboymacke's PR. thanks!

@hajimehoshi hajimehoshi changed the title CanvasEventHandlers fails to handle drop within the web browser internal/ui: crash by dropping an HTML element onto the canvas Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants