QEvents triggered twice in my QWebSocket
-
Hello everyone,
My application is using React for the frontend and C++ for the backend. The communication between both is implemented using
QWebEngine
and theQWebChannel
.I recently updated Qt from version 5.10.1 (msvc_2015) to 5.15.2 (msvc_2019) and I encountered a weird behavior after the update:
In the UI, I have a button used to trigger a BE signal opening aQDialog
. If I start the application and click on this button, theQWebSocket
will emit twice the signaltextMessageReceived
. But then, if I click again on the same button, it will fire only once. This behavior is 100% reproducible (meaning that if I restart the application and perform the same steps, it will happen again), but is also random because I couldn't link the behavior with a given component of my UI. This happens several times during the run of my application, for different signals.I started investigating the stack in debug mode and noticed that the
QEventDispatcherWin32
is posting events in thebool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
function as well as inLRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
, and that the events handled invoid QCoreApplication::sendPostedEvents(QObject *receiver, int event_type)
result both to the same message sent to myQWebSocket
. I also analyzed the network to be sure that the signal is not triggered twice by the FE.If you need it, I can add the call stacks.
I tried to reproduce a minimal example but, unfortunately, couldn't reproduce it.
Does anyone recognize the symptoms or has any idea of what is the issue?
Thank you very much