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

Make WebEngineContext recreatable

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.3
    • WebEngine

    Description

      It seems like WebEngineContext is designed in such a way that it cannot be used ever again after QCoreApplication is destroyed once.

      In our particular case, we are trying to do a restartable application (based on the pattern here https://wiki.qt.io/How_to_make_an_Application_restartable) , so we destroy and recreate QCoreApplication (or rather QApplication, is it is a widget app). But, when then we try to recreate QWebEngineView, the application crashes with a nullptr dereference.

       

      Inspecting the source code for WebEngineContext, in particular the handling of the singleton (::current()), the variable "s_destroyed" and the call to qAddPostRoutine(destroyContext) , leads us to beleave the WebEngineContext::current() will only return a valid pointer during the first creation of QCoreApplication. Once that first instance of QCoreApplication is destroyed, 'destroyContext' will be called, which will set 's_destroyed' to true. And from there onwards ::current() will return nullptr.

       

      If this is an intended restriction on QWebEngine, then it should be documented clearly in the documentation of the class. (I couldn't see it mentioned anywhere)

       

      Attachments

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

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            rbenet Raul Benet
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes