Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.1.0 RC1
-
None
-
Kubuntu 13.04 (GCC 4.7.3)
Description
On the latest git version of Qt, when trying to assign C++ properties from different libraries in QML,
I got a message like "Unable to assign "Foo" to "Foo"" which made me
really scratch my head. I digged into this, and it turns out that the
problem is due to the QML property assignment code only checking the
memory address of the meta-object's class name string, but not their
contents. This fails if the program uses shared library plugins which
causes (at least on my Kubuntu 13.04 system) the generation of two
identical meta-objects with the content of the strings being placed in
different data segments. This patch fixes this problem by first
comparing the memory addresses, then the size of the class name and if
the former differ but the latter are identical, compares the contents
of the class name string.
I've attached a patch, which I place under the public domain to ease inclusion into the repository. If you need a regression test, I suppose that I can cook down my code sufficiently, but that will take some time. If I did something wrong, I'm sorry that I have disturbed you, but I would be very grateful if you would suggest a way to fix my issue.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-31506 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
61090,2 | Declarative: fix assignment of custom properties from different libs | stable | qt/qtdeclarative | Status: ABANDONED | -2 | 0 |
61902,4 | declarative: print warning if single meta-object policy is violated | stable | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |