woboq / qmetaobject-rs

Integrate Qml and Rust by building the QMetaObject at compile time.
MIT License
620 stars 89 forks source link

QSocketNotifier: Can only be used with threads started with QThread #295

Closed andrew-otiv closed 11 months ago

andrew-otiv commented 11 months ago

Immediately after I call QmlEngine::new() I get the message:

QSocketNotifier: Can only be used with threads started with QThread

I observe this when initializing the QmlEngine from both an async main() and a non async main().

Is this problematic? Execution does continue afterwards.

ratijas commented 11 months ago

I might be mis-reading this, but…

Why would want to create QmlEngine in some other thread that not your main one? I wouldn't expect UI to work well with that.

andrew-otiv commented 11 months ago

I was calling it from my main thread. I thought I had reproduced it in a non-async context, but I'm not seeing this message anymore when I run my cleaned up version, so I'll just close the ticket.

RE why would you ever run the UI on a non-main thread? There is only one main thread for the process; any two libraries that say they have to run in the main thread are incompatible. I suspect aync main was running my code in a side thread, and I just screwed up my reproducton on non-async (maybe a stale binary got run somehow).