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

[bug] Cannot load textures #494

Closed
dqhieuu opened this issue Apr 5, 2022 · 3 comments · Fixed by #495
Closed

[bug] Cannot load textures #494

dqhieuu opened this issue Apr 5, 2022 · 3 comments · Fixed by #495
Labels
bug Something isn't working

Comments

@dqhieuu
Copy link

dqhieuu commented Apr 5, 2022

What happend?

I try to add textures to the canvas like the example code does, but it always returns an error
giu: .NewTextureFromRgba: cannot load texture befor (*MasterWindow).Run call!

Edit: after running it in a goroutine, it finally loads now.
The example code should be changed and tested because the load function won't work if not put in a goroutine.
I think there were comments from earlier version that said that you need to run that function in a goroutine. I wonder why you removed it?

Edit2: Actually, running a goroutine doesn't ensure that it will work. I can only run it by setting the timer and delay the function by 100ms
Where can I run the texture load function if the run function is the last one called and the load function only works when the app is running?

Code example

The example code from https://github.com/AllenDang/giu/blob/master/examples/canvas/canvas.go

To Reproduce

  1. Run my demo
  2. will see the crash...

Version

(latest)

OS

Windows 11

@dqhieuu dqhieuu added the bug Something isn't working label Apr 5, 2022
@dqhieuu dqhieuu changed the title [bug] [bug] Cannot load textures Apr 5, 2022
@gucio321
Copy link
Collaborator

gucio321 commented Apr 5, 2022

well, let me check it. Maybe checking if MainWindow is open isn't necessary anymore after some changes... Not exactly sure.

gucio321 added a commit to gucio321/giu that referenced this issue Apr 5, 2022
…(*MasterWindow).Run

no idea why is it necessary. everything seems working.
I had to forget about removeing something in AllenDang#451

fix AllenDang#494
@gucio321
Copy link
Collaborator

gucio321 commented Apr 5, 2022

yah, panic call isn't necessary there. Opened PR.

@dqhieuu
Copy link
Author

dqhieuu commented Apr 5, 2022

Great! Hopefully it won't cause any memory leak.

@dqhieuu dqhieuu closed this as completed Apr 5, 2022
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

Successfully merging a pull request may close this issue.

2 participants