Izowiuz / iz-libuv-event-dispatcher

MIT License
1 stars 1 forks source link

Compatibility with recent libuv? #1

Open mincequi opened 9 months ago

mincequi commented 9 months ago

Hi there, I stumbled across this project while searching for a decent libuv-Qt integration. However, this does not work with a recent version of libuv. Are there any plans to update this from your side?

Thanks in advance.

Izowiuz commented 9 months ago

On it. Will try to fix it ASAP. Depends a bit on scope of the changes.

mincequi commented 9 months ago

Great news!

Actually not quite sure whether libuv is the reason or Qt.

But thanks anyway!

Izowiuz commented 9 months ago

So. I have prepared some changes and/or fixes and pushed them straight on top of the master branch : P It seems to compile and even works! I have created a new repository for an example integration: https://github.com/Izowiuz/iz-libuv-event-dispatcher-integration

Code in it uses FetchContent_Declare to slurp this repository and contains a small example with a single QTimer. Proper output should be similar to:

image

I use vcpkg to get my packages. I have tested Qt 6.6.0 and libuv 1.46.0

Let me know if it works for you and if not, we will figure something out.

mincequi commented 9 months ago

Ok, just testes it with my app: https://github.com/mincequi/iotic. However it (still) crashes here:

Screenshot 2023-11-19 at 21 24 25

There is a failing assertion within uv_close()

Izowiuz commented 9 months ago

Oh, that's seems bad. But good news is I can debug it using your app. Is there something specific I have to do to induce the crash?

mincequi commented 9 months ago

Great, I just prepared a branch for you to test/debug: https://github.com/mincequi/iotic/tree/uv_dispatcher

I did not use fetch_content for that for now. Just copied your source files.

There is nothing special to do. Just start the app. I will crash immediately.

Izowiuz commented 9 months ago

I think I reproduced the problem that you are having. I trip the same assert in call to void LibUvEventDispatcher::unregisterSocketNotifier(QSocketNotifier* notifier)

I have one question about how should I run your app. Are commented out parts from here: https://github.com/mincequi/iotic/commit/0efdc49309ae7cb8bd2da64c61870d0da6ce93ff important? They seem to be needed if virtual fs of cmrc is to be used and with them commented out I get:

image

mincequi commented 9 months ago

Hi @Izowiuz ,

thanks for your effort to tackle this issue. I just pushed another change, because my app also fails if there is a config file missing (and I fixed that for testing purposes).

Actually, I do not suspect those commented lines to be an issue (at least as long you do not try to access the web interface). I just wanted to safe your time from also compiling the web-app using flutter. But your error indicates that you are already one step ahead.

Just in case you are motivated to let my app run full-featured, you can revert https://github.com/mincequi/iotic/commit/0efdc49309ae7cb8bd2da64c61870d0da6ce93ff and try to integrate the web-app as well (using flutter, see README.md).

Izowiuz commented 9 months ago

I've pushed some changes: https://github.com/Izowiuz/iz-libuv-event-dispatcher/commit/110d6e266a4d279a57dc51f9e7aacd384b644f6d that fix a silly mistake in deinitialization of the uv handlers. I also now check if a uv handle that I want to close is not already in a closing state.

Let me know if this fixed your issue and if not - I will return to debugging.