dontpanic92 / wxGo

Golang wxWidgets Wrapper
Other
403 stars 51 forks source link

Grid Windows 64 issue #62

Closed undeadindustries closed 6 years ago

undeadindustries commented 6 years ago

I have a simple app that creates:

Frame->VSizer->Panel->VSizer->GridSizer-> and then 1 grid in each row of the grid sizer. (parent->child)

This is the strangest issue. It compiles perfect. But it only runs sometimes. If you try to run it again, or recompile and run again, the frame never opens but you can see the process in the process list.

Could that be a garbage collection issue?

glycerine commented 6 years ago

@undeadindustries can you provide code to reproduce the issue?

undeadindustries commented 6 years ago

@glycerine. It's sort of big. Can I zip it and email it to you?

glycerine commented 6 years ago

@undeadindustries that would be fine. my email is on my github profile.

glycerine commented 6 years ago

@undeadindustries Also please let me know what version of Go and which OS you are using.

undeadindustries commented 6 years ago

Did you receive my file? I'm running Windows 10 64 April Update. However, this happened before the april update too.

I was playing around with this last night, going through every line. I can't find any errors.

If you can't replicate this, I'd be happy to have you VNC into my machine to see.

Thank you again.

undeadindustries commented 6 years ago

Another piece to the puzzle. When the program runs, and the window doesn't open, you can to ctrl-C out of it... When you do that, you can't do anything like rename the folder it is in because "some files are in use".

Possibly it's a memory management thing with all the grids? Possibly Destroy isn't getting rid of them? That's why it only runs once correctly?

glycerine commented 6 years ago

Try adding to main.go the following import and init function, which will make sure that the main() runs on the "main" thread.

import "runtime"
...
func init() {
   runtime.LockOSThread()
}

details/reference https://github.com/golang/go/wiki/LockOSThread

@undeadindustries see if that works for you.

glycerine commented 6 years ago

@undeadindustries For the benefit of others who encounter a similar problem in the future, let us know if that fixed the issue for you.

undeadindustries commented 6 years ago

That seemed to fix it. Thanks!!!