Open Hejsil opened 3 weeks ago
the program ends
You mean unwanted exit, like a crash? Or a normal exit?
Is there a reason why blocking = false is passed to gtk_main_iteration_do?
I guess if blocking = true
the websocket server will be blocked or something... you can easily test it to be sure.
just change the line, and run make
.
the program ends
You mean unwanted exit, like a crash? Or a normal exit?
Aaah no. I guess that is bad phrasing. The program will spin on this loop (100% CPU usage) after opening a window. So the program "ends up" here once the window has been opened.
I guess if
blocking = true
the websocket server will be blocked or something... you can easily test it to be sure. just change the line, and runmake
.
Aah ok. Just tested a little further. It does not seem this is the loop that causes 100% CPU usage. I just assumed (my bad)
Just pulled latest main
branch and built examples/C/minimal
and I still see this issue
Looking at usage, it seems that two cores are constantly at 100%. System info:
uname: Linux 6.8.0-49-generic #49-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 4 02:06:24 UTC 2024 x86_64
compiler info: gnuc: 13.2
libc info: glibc: 2.39
I guess you are using a webview.
Can you please change show()
to use a web browser?
webui_show_browser(win, "<html><head><script src=\"webui.js\"></script></head> Hello World ! </html>", Chrome); // Or Firefox, whatever you have
I guess you are using a webview. Can you please change
show()
to use a web browser?webui_show_browser(win, "<html><head><script src=\"webui.js\"></script></head> Hello World ! </html>", Chrome); // Or Firefox, whatever you have
No issues using Firefox
as the browser
Just to confirm, the screenshot you included it's a webview, right?
Just to confirm, the screenshot you included it's a webview, right?
Yes it is
Fixed (https://github.com/webui-dev/webui/commit/984de15efaab4f0184f708b1ec4111f68628607b). Thank you @Hejsil for reporting this.
Can you please re-test and confirm?
When running webui with WebView as the browser the program ends in the following busy loop:
https://github.com/webui-dev/webui/blob/d5b25ca1a827d3ec07be9607232edb0c27172918/src/webui.c#L3099-L3101
This causes high CPU usage. Is there a reason why
blocking = false
is passed togtk_main_iteration_do
?