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

[Reg 6.5 -> 6.8] Qt 6.8 silently removed sharing of global variables between 2 typescript/javascript files

    XMLWordPrintable

Details

    • c9778d2e9 (dev), 3883faa5a (6.9), 23ba02740 (dev), c1bd8ee91 (6.9), 413fa907d (6.8), 68b2b2fb9 (6.8)

    Description

      In our project, we currently use Qt 6.3.2, which is an application that with help qrc bundle itself into single binary.
      We use C++, but most of our code is in QML and typescript(compiled in cmake to javascript files)

      We wanted to update to latest LTS - 6.8.1

      We use something like that

      main.qml

      import QtQuick
      // import "b1.mjs" as B1 // Uncommenting this line, triggers bug
      
      Window {
          id: mainWindow
          objectName: "mainWindow"
          width: 500
          height: 500
          visible: true
      
          Loader {
              id: contentLoader
              anchors.fill: parent
              source: "loaded.qml"
          }
      }
      

      loaded.qml

      import QtQuick
      import "./a1.mjs" as A1
      import "./b1.mjs" as B1
      
      Item {
          id: root
      
          Component.onCompleted: {
              A1.process_a1()
              B1.read_from_b1()
          }
      }
      

      a1.mjs

      import {read_from_b1} from "./b1.mjs";
      
      export let data_a1: any
      
      export function process_a1() {
          data_a1 = "DATA_IN_A1"
          console.error("In a1 -", data_a1)
          read_from_b1()
      }
      

      b1.mjs

      import {data_a1} from "./a1.mjs";
      
      export function read_from_b1() {
          console.error("In B1", data_a1)
      }
      

      in versions <6.8 (I found that this works fine up to 6.7.3 version) or with line `import "b1.mjs" as B1` commented in main.qml I see

      In a1 - DATA_IN_A1
      In B1 DATA_IN_A1
      In B1 DATA_IN_A1
      

      but in 6.8(both 6.8.0 and 6.8.1) with uncommented line I see

      In a1 - DATA_IN_A1
      In B1 undefined
      In B1 undefined
      
      

      I couldn't find any info in changelog that could point that this behavior is changed, so I assumed that this may be a bug

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            rafalmik Wojciech Frey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews