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

Deprecate injected arguments for signal handlers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.15.2, 6.0.0
    • Fix Version/s: 6.1
    • Component/s: QML: Compiler
    • Platform/s:
      Linux/Wayland
    • Commits:
      06d819cd714542427ed9f70820b84004c874a9db e337ba277beb6d08dbb9ca78e74d6cc22f56e3b6 8784a2778063cf928b27a908f6580ed37cb4035d b7412dc86608207cba84538cb962e4300dfe42c1

      Description

      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.

        Attachments

          Issue Links

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

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: