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

Deprecate injected arguments for signal handlers

XMLWordPrintable

    • Linux/Wayland
    • 06d819cd714542427ed9f70820b84004c874a9db e337ba277beb6d08dbb9ca78e74d6cc22f56e3b6 8784a2778063cf928b27a908f6580ed37cb4035d b7412dc86608207cba84538cb962e4300dfe42c1

      The following code snippet does not work correctly when running it with the code pre-compiled with qmlcachegen:

      import QtQuick 2.0
      import QtQuick.Window 2.1
      Window {
          width: 800
          height: 600
          visible: true
          signal sig(string arg)
          onSig: {
              print("SIG", arg);
              var arg = "bar";
          }
          Component.onCompleted: {
              sig("foo");
          }
      }
      
      $ qmlcachegen sig.qml -o sig.qmlc
      $ qml sig.qml
      qml: SIG undefined
      $ QML_DISABLE_DISK_CACHE=1 qml sig.qml
      qml: SIG foo
      

      The behavior is correct when disk cache is disabled.

      Commenting the 'var arg = "bar"' line fixes the issue, but leaving it seems to prevent the code from resolving the signal parameter "arg" when executing the function.

        For Gerrit Dashboard: QTBUG-89943
        # Subject Branch Project Status CR V

            ulherman Ulf Hermann
            rawoul Arnaud Vrac
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: