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

Windows threading issue - cannot open additional windows #24

Closed
zet4 opened this issue Oct 16, 2018 · 16 comments
Closed

Windows threading issue - cannot open additional windows #24

zet4 opened this issue Oct 16, 2018 · 16 comments
Labels
bug Something isn't working

Comments

@zet4
Copy link

zet4 commented Oct 16, 2018

Hello, I setup my environment according to the getting started (i am using windows as title mentions).
The rendering of some texts (at the top for example) seems to be bugged compared to the screenshots in the repo.
image
Additionally, none of the buttons aside from Dark/Light and Quit seem to work.
I also tried running the example from the other repo, it rendered the 4 buttons but nothing happens when pressing on them.
For now I am afraid there's nothing else I can provide as there are no errors or log messages anywhere.

@andydotxyz
Copy link
Member

It looks like you’re missing the vector graphics module in efl - which version did you manage to install?

@andydotxyz
Copy link
Member

The buttons not working issue is a new one on me though! What version of Windows is this?

@zet4
Copy link
Author

zet4 commented Oct 17, 2018

This was run on Windows 10 Home 1809 - Build 17763.1
And I installed the latest EFL, according to Win-Builds.
image

@andydotxyz
Copy link
Member

Oh dear, I had not realised how far behind winbuilds was. EFL current release is 1.21.1 and Fyne requires 1.19 for the vector graphics to appear. I guess we will have to push forward with the custom build of EFL to bootstrap Fyne with all the features.

I will try to replicate the buttons issues locally. It did work earlier but there may be a strange recent issue - I noticed that macOS does not always register presses correctly either :(

If you are interested in investigating further then adding some logging to the mouse down callbacks within desktop/canvas.go may be a help.

Apologies!

@zet4
Copy link
Author

zet4 commented Oct 18, 2018

I am not really sure how to update my EFL installation, msys's pacman doesn't know of efl either.
Anyway, I will try to figure out the window opening issue for now.

@zet4
Copy link
Author

zet4 commented Oct 18, 2018

Right so I added some basic logging to console, the issue wasn't button down event.
Rather it seems to be something with C.ecore_thread_main_loop_begin:

$ go run main.go
2018/10/18 12:27:54 create window Examples
2018/10/18 12:27:54 engine software_gdi
2018/10/18 12:27:54 main loop begin
2018/10/18 12:27:54 window init
2018/10/18 12:27:54 canvas thingy
2018/10/18 12:27:54 main loop end
2018/10/18 12:27:54 window &{0x426be30 0xc0000c8100 false false false <nil>}
2018/10/18 12:27:54 callbacks done...
2018/10/18 12:27:59 Form clicked...
2018/10/18 12:27:59 create window Form
2018/10/18 12:27:59 engine software_gdi

main loop begin should have followed after engine line but it doesn't and so that function never returns, problematic line being 263 in desktop/window.go, that is of course not the problematic line, something, somewhere, is never releasing the lock (which I am guessing is the purpose of C.ecore_thread_main_loop_end call), I tried looking at other references of this C call but none look problematic either, so I am lost as to why this is happening... but I bet this is tied to EFL version being old af.

@andydotxyz
Copy link
Member

Yes I think you’re on to something there. Can you possibly print the return of the main_loop_begin call and also the result of C.eina_main_loop_is? That should tell us more about the context. I’d guess that either there is a weird behaviour with those methods or that the threading model changed and so we should be using a different arrangement of safety checks.

@zet4
Copy link
Author

zet4 commented Oct 18, 2018

Seems like for the first window main_loop_is reports 1, anything after that returns 0.

2018/10/18 18:07:57 create window Examples
2018/10/18 18:07:57 engine software_gdi
2018/10/18 18:07:57 main_loop_is 1
2018/10/18 18:07:57 main loop begin 1
2018/10/18 18:07:57 window init
2018/10/18 18:07:57 canvas thingy
2018/10/18 18:07:57 main loop end
2018/10/18 18:07:57 window &{0xdfbe30 0xc0000c8100 false false false <nil>}
2018/10/18 18:07:57 callbacks done...
2018/10/18 18:08:13 Form clicked...
2018/10/18 18:08:13 create window Form
2018/10/18 18:08:13 engine software_gdi
2018/10/18 18:08:13 main_loop_is 0

Though I am not sure the order I am making the calls in is correct...

func CreateWindowWithEngine(engine string) fyne.Window {
    // ...
    log.Println("main_loop_is", C.eina_main_loop_is())
    log.Println("main loop begin", C.ecore_thread_main_loop_begin())
    // ...

@zet4
Copy link
Author

zet4 commented Oct 18, 2018

It's worth noting main_loop_begin only returns for the first window, and never afterwards.

@andydotxyz
Copy link
Member

Thanks for all of that.
I have pushed an update to Fyne that refactors this a little to only request a thread change if needed.

Can you please update and let me know how, if at all, this changes things?
It could fix it - or could make it worse...

@zet4
Copy link
Author

zet4 commented Oct 19, 2018

Well I tried the latest changes and all that did for me is themes stopped working, ie. Light/Dark doesn't do anything. I did put log message into the function to check if it was being called and it does indeed log but the settings either don't re-apply or don't change, not sure which. Nothing else seems to have changed.

@andydotxyz
Copy link
Member

Ok thanks. I guess that’s at least consistent..? I will get my Windows machine updated this weekend and see if I can replicate.

@andydotxyz
Copy link
Member

I had a quick look and there is nothing obvious unfortunately so I will have to dig into this further. I will work through old states of the code and see if I can find what broke Windows :(

@andydotxyz andydotxyz changed the title Windows - Rendering issues; Only one window opens Windows threading issue - cannot open additional windows Oct 20, 2018
@andydotxyz andydotxyz added the bug Something isn't working label Oct 20, 2018
@zet4
Copy link
Author

zet4 commented Oct 21, 2018

While unrelated now to this issue, I do still wonder how one would go about getting latest or at least minimal required version of EFL for windows now.

@andydotxyz
Copy link
Member

This threading issue is now fixed :)

@zet4
Copy link
Author

zet4 commented Oct 21, 2018

Yep, working for me now, thanks!

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