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. Does QWebEnginePage::load() start a new event loop internally or it just calls processEvents() ?

Does QWebEnginePage::load() start a new event loop internally or it just calls processEvents() ?

Scheduled Pinned Locked Moved Unsolved QtWebEngine
qwebenginepageqeventloop
4 Posts 2 Posters 1.0k 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.
  • C Offline
    C Offline
    comy
    wrote on last edited by comy
    #1

    After debugging an application crash, I have found that QWebEnginePage::load() internally processes queued events and causes unexpected re-entrancy in my code.
    I have modified my code to handle reentrancy, but there are parts of my code that invoke deleteLater(). To be sure that some objects will not get deleted while within QWebEnginePage::load(), I would like to know if that method starts internally an event loop or it just calls processEvents() ?

    Thanks in advance.

    JonBJ 1 Reply Last reply
    1
    • C comy

      After debugging an application crash, I have found that QWebEnginePage::load() internally processes queued events and causes unexpected re-entrancy in my code.
      I have modified my code to handle reentrancy, but there are parts of my code that invoke deleteLater(). To be sure that some objects will not get deleted while within QWebEnginePage::load(), I would like to know if that method starts internally an event loop or it just calls processEvents() ?

      Thanks in advance.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @comy said in Does QWebEnginePage::load() start a new event loop internally or it just calls processEvents ?:

      I would like to know if that method starts internally an event loop or it just calls processEvents().

      Having recently struggled with QWebEnginePage and the freeing of objects. My confused-and-without-guarantee finding was that thingies->deleteLater() did not free them until I returned to the main Qt event loop. Just like calling only processEvents(). Which for me was just what I did not want, but I think for you it is what you'd like.

      As per https://doc.qt.io/qt-5/qcoreapplication.html#processEvents, these are DeferredDelete events.

      I think you know that, and from the way you phrased your question you know more than I! So I should like to ask you a question!

      When you say

      start a new event loop internally or it just calls processEvents

      and the docs say

      In the event that you are running a local loop which calls this function continuously, without an event loop

      I don't understand just what is meant beyond calling processEvents()? What is/how do you write a "new local event loop" instead?

      C 1 Reply Last reply
      0
      • JonBJ JonB

        @comy said in Does QWebEnginePage::load() start a new event loop internally or it just calls processEvents ?:

        I would like to know if that method starts internally an event loop or it just calls processEvents().

        Having recently struggled with QWebEnginePage and the freeing of objects. My confused-and-without-guarantee finding was that thingies->deleteLater() did not free them until I returned to the main Qt event loop. Just like calling only processEvents(). Which for me was just what I did not want, but I think for you it is what you'd like.

        As per https://doc.qt.io/qt-5/qcoreapplication.html#processEvents, these are DeferredDelete events.

        I think you know that, and from the way you phrased your question you know more than I! So I should like to ask you a question!

        When you say

        start a new event loop internally or it just calls processEvents

        and the docs say

        In the event that you are running a local loop which calls this function continuously, without an event loop

        I don't understand just what is meant beyond calling processEvents()? What is/how do you write a "new local event loop" instead?

        C Offline
        C Offline
        comy
        wrote on last edited by
        #3

        @JonB Starting a new local event loop is done by executing QEventLoop::exec(). That is what for example QDialog::exec() does. It blocks and performs event processing, where processEvents just processes what is in the queue and returns.
        I hope somebody can confirm to me that this is not the case with QWebEnginePage::load(), for which I know it does process events, just not sure if by starting event loop or with call to processEvents().

        JonBJ 1 Reply Last reply
        0
        • C comy

          @JonB Starting a new local event loop is done by executing QEventLoop::exec(). That is what for example QDialog::exec() does. It blocks and performs event processing, where processEvents just processes what is in the queue and returns.
          I hope somebody can confirm to me that this is not the case with QWebEnginePage::load(), for which I know it does process events, just not sure if by starting event loop or with call to processEvents().

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @comy said in Does QWebEnginePage::load() start a new event loop internally or it just calls processEvents() ?:

          @JonB Starting a new local event loop is done by executing QEventLoop::exec().

          Oh I see, just QEventLoop::exec(). Yes, I had tried that. According to me it made no difference, and deleteLater()s of QWebEngine stuff still didn't free till execution got back to my top-level Qt event loop. Didn't understand why, your mileage may vary :)

          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