Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-73876

QWebEnginePage::runJavaScript hangs when called from a slot in response to a QWebEnginePage::selectionChanged signal

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.13.0 Beta 1
    • 5.12.1
    • WebEngine
    • None
    • macOS 10.14.3
    • 5a6a8509a96ef6795102422e217d609815d2f086 (qt/qtwebengine/dev)

    Description

      In our application, we're attempting to respond to the QWebEnginePage::selectionChanged signal in order to update a set of buttons to show the bold, underline, italics, etc., status of the current selection. In our slot, I ultimately call QWebEnginePage::runJavaScript and have code that waits for the callback to update a QHash. The wait code calls processEvents to keep things responsive while waiting.

      In both the attached sample app and our real-world app, five calls are made to QWebEnginePage::runJavaScript, waiting for the callback to execute before making the next call (or timing out after five seconds). All five calls time-out. Then, suddenly all five QWebEnginePage::runJavaScript callbacks execute.

      Notice that by pressing either of the "Run JavaScript" buttons in the sample app, everything works fine. It's only when calling QWebEnginePage::runJavaScript from within a slot that handles QWebEnginePage::selectionChanged (or for that matter, QWebEngineView::selectionChanged) that the app hangs.

      To see the problem, compile and run the attached sample app. Double-click over some of the text in either text field. Watch the console to see the timeouts.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            juri.valdmann Jüri Valdmann (Inactive)
            craig_kaufman Craig Kaufman
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes