Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QEvents triggered twice in my QWebSocket
QtWS25 Last Chance

QEvents triggered twice in my QWebSocket

Scheduled Pinned Locked Moved Unsolved QtWebEngine
qt5.15.2websocketwebchannel
1 Posts 1 Posters 321 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kili236
    wrote on last edited by
    #1

    Hello everyone,

    My application is using React for the frontend and C++ for the backend. The communication between both is implemented using QWebEngine and the QWebChannel.

    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 a QDialog. If I start the application and click on this button, the QWebSocket will emit twice the signal textMessageReceived. 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 the bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) function as well as in LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp), and that the events handled in void QCoreApplication::sendPostedEvents(QObject *receiver, int event_type) result both to the same message sent to my QWebSocket. 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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved