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. Crash when quitting app (cause by create C++ object in QML)
Forum Updated to NodeBB v4.3 + New Features

Crash when quitting app (cause by create C++ object in QML)

Scheduled Pinned Locked Moved Unsolved QtWebEngine
4 Posts 3 Posters 396 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.
  • H Offline
    H Offline
    Huy Nguyen
    wrote on 24 Apr 2024, 03:26 last edited by Huy Nguyen
    #1

    Hi all, i am creating a QT app which displaying Google Maps via WebEngine. To improve performance and enable debugging, i link the release library of QT with debug mode like this.

    CMakeLists.txt

    find_package(Qt6 COMPONENTS Gui Qml Quick webenginequick)
    set_target_properties(
        Qt6::Qml
        Qt6::Core
        Qt6::Gui
        Qt6::WebEngineQuick
        PROPERTIES MAP_IMPORTED_CONFIG_DEBUG Release)
    

    I created a C++ object in QML side like this, and the crash always occurs when i quitting the app.

    main.qml

    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
    
        Rectangle{
            x: 20
            y: 20
            width: 20
            height: 20
            color: "red"
           //TestClass is a very simple C++ class derived from QObject
            TestClass{
         
            }
        }
    }
    

    When I tried debugging, I found that an error occurred when destroying a QML element
    a03fa703-8175-4de2-be5b-2f63e4497f1e-image.png
    The crash only occurs when I link the release library with debug mode. If the library version and build mode are the same (both debug or both release), this will not happen. Can anyone explain to me ??? Thank you so much !

    C 1 Reply Last reply 24 Apr 2024, 04:35
    0
    • H Huy Nguyen
      24 Apr 2024, 03:26

      Hi all, i am creating a QT app which displaying Google Maps via WebEngine. To improve performance and enable debugging, i link the release library of QT with debug mode like this.

      CMakeLists.txt

      find_package(Qt6 COMPONENTS Gui Qml Quick webenginequick)
      set_target_properties(
          Qt6::Qml
          Qt6::Core
          Qt6::Gui
          Qt6::WebEngineQuick
          PROPERTIES MAP_IMPORTED_CONFIG_DEBUG Release)
      

      I created a C++ object in QML side like this, and the crash always occurs when i quitting the app.

      main.qml

      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Rectangle{
              x: 20
              y: 20
              width: 20
              height: 20
              color: "red"
             //TestClass is a very simple C++ class derived from QObject
              TestClass{
           
              }
          }
      }
      

      When I tried debugging, I found that an error occurred when destroying a QML element
      a03fa703-8175-4de2-be5b-2f63e4497f1e-image.png
      The crash only occurs when I link the release library with debug mode. If the library version and build mode are the same (both debug or both release), this will not happen. Can anyone explain to me ??? Thank you so much !

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 24 Apr 2024, 04:35 last edited by
      #2

      You must not mix debug and release libs on windows with MSVC as they are using different MSVC runtimes.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      H 1 Reply Last reply 24 Apr 2024, 06:32
      1
      • C Christian Ehrlicher
        24 Apr 2024, 04:35

        You must not mix debug and release libs on windows with MSVC as they are using different MSVC runtimes.

        H Offline
        H Offline
        Huy Nguyen
        wrote on 24 Apr 2024, 06:32 last edited by Huy Nguyen
        #3

        @Christian-Ehrlicher said in Crash when quitting app (cause by create C++ object in QML):

        You must not mix debug and release libs on windows with MSVC as they are using different MSVC runtimes.

        The speed of displaying Google Maps on WebEngine in Debug mode is very slow, so I use WebEngine's release library and build in debug mode to serve debugging. Is there a better solution to improve the speed of WebEngine in debug mode?

        J 1 Reply Last reply 24 Apr 2024, 07:01
        0
        • H Huy Nguyen
          24 Apr 2024, 06:32

          @Christian-Ehrlicher said in Crash when quitting app (cause by create C++ object in QML):

          You must not mix debug and release libs on windows with MSVC as they are using different MSVC runtimes.

          The speed of displaying Google Maps on WebEngine in Debug mode is very slow, so I use WebEngine's release library and build in debug mode to serve debugging. Is there a better solution to improve the speed of WebEngine in debug mode?

          J Online
          J Online
          JonB
          wrote on 24 Apr 2024, 07:01 last edited by
          #4

          @Huy-Nguyen No, I think you are stuck with the speed if you wish to use the Debug build.

          1 Reply Last reply
          0

          1/4

          24 Apr 2024, 03:26

          • Login

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