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

"QML debugging is enabled" warning is not guaranteed to show at startup

    XMLWordPrintable

Details

    • 032ecd52f (dev), 884b3c575 (6.9), e9b829360 (6.8)

    Description

      Code

      import QtQuick 2.15
      import QtQuick.Window 2.15
      
      Window {
          width: 640
          height: 480
          visible: true
      
          Component.onCompleted: console.log("Hi")
          Component.onDestruction: console.log("Bye")
      }
      

       

      Outcomes
      Sometimes, the warning doesn't appear at all:

      11:45:11: Debugging D:\Test\untitled5\build\Desktop_Qt_6_8_1_MinGW_64_bit-Debug\debug\untitled5.exe "-qmljsdebugger=port:59836,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation" ...
      QML Debugger: Waiting for connection on port 59836...
      qml: Hi
      qml: Bye
      11:45:15: Debugging of D:\Test\untitled5\build\Desktop_Qt_6_8_1_MinGW_64_bit-Debug\debug\untitled5.exe "-qmljsdebugger=port:59836,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation" has finished with exit code 0.
      

       

      Sometimes, it appears after the app quits:

      11:33:08: Starting D:\Test\untitled5\build\Desktop_Qt_6_8_1_MinGW_64_bit-Debug\debug\untitled5.exe...
      qml: Hi
      qml: Bye
      QML debugging is enabled. Only use this in a safe environment.
      11:33:10: D:\Test\untitled5\build\Desktop_Qt_6_8_1_MinGW_64_bit-Debug\debug\untitled5.exe exited with code 0
      

       

      Fix
      If I add fflush(stderr); to the start of my main() function, then the warning appears at startup:

      11:48:04: Debugging D:\Test\untitled5\build\Desktop_Qt_6_8_1_MinGW_64_bit-Debug\debug\untitled5.exe "-qmljsdebugger=port:64112,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation" ...
      QML debugging is enabled. Only use this in a safe environment.
      QML Debugger: Waiting for connection on port 64112...
      qml: Hi
      qml: Bye
      11:48:07: Debugging of D:\Test\untitled5\build\Desktop_Qt_6_8_1_MinGW_64_bit-Debug\debug\untitled5.exe "-qmljsdebugger=port:64112,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector,DebugTranslation" has finished with exit code 0.
      

       

      It looks like simply printing a newline character is not enough to flush the contents of stderr to Qt Creator's Application Output pane: https://codereview.qt-project.org/c/qt/qtdeclarative/+/251021/

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              skoh-qt Sze Howe Koh
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes