Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.2, 6.0.0
-
-
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
- relates to
-
QTBUG-73064 deprecate context properties in QML
- Open
For Gerrit Dashboard: QTBUG-89943 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
333320,4 | Deprecate plain blocks as signal handlers | dev | qt/qtdeclarative | Status: ABANDONED | +1 | 0 |
333779,11 | Use functions as signal handlers when accessing parameters | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
334051,4 | QML: Warn about variables being used before their declaration | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
334052,3 | qmllint: Warn about too many or mismatched signal parameters | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
334085,3 | QML: Warn about variables being used before their declaration | 6.1 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
334101,3 | QML: Warn about usage of injected signal parameters | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
334126,3 | qmllint: Warn about too many or mismatched signal parameters | 6.1 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
334285,2 | Use functions as signal handlers when accessing parameters | 6.1 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
334386,2 | QML: Warn about usage of injected signal parameters | 6.1 | qt/qtdeclarative | Status: MERGED | +2 | 0 |