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

v4 accesses property of wrong object

    XMLWordPrintable

Details

    Description

      See http://codereview.qt-project.org/18494 for an autotest reproducing the issue.

      The following seems to fix the issue, but I am not sure if it is correct/complete

      diff --git a/src/declarative/qml/v4/qv4irbuilder.cpp b/src/declarative/qml/v4/qv4irbuilder.cpp
      index 522bc01..4445f02 100644
      --- a/src/declarative/qml/v4/qv4irbuilder.cpp
      +++ b/src/declarative/qml/v4/qv4irbuilder.cpp
      @@ -624,7 +624,8 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast)
       
                   case IR::Name::Property: 
                       if (baseName->type == IR::ObjectType && baseName->meta && baseName->property->isFinal()) {
      -                    QDeclarativePropertyCache *cache = m_engine->cache(baseName->meta);
      +                    const QMetaObject *meta = m_engine->metaObjectForType(baseName->property->propType);
      +                    QDeclarativePropertyCache *cache = m_engine->cache(meta);
                           if (!cache)
                               return false;
       
      @@ -636,9 +637,9 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast)
                                   return false; // We don't know enough about this property
                               }
       
      -                        IR::Type irType = irTypeFromVariantType(data->propType, m_engine, baseName->meta);
      +                        IR::Type irType = irTypeFromVariantType(data->propType, m_engine, meta);
                               _expr.code = _block->SYMBOL(baseName, irType, name,
      -                                                    baseName->meta, data, line, column);
      +                                                    meta, data, line, column);
                           }
                       }
                       break;
      

      Attachments

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

        Activity

          People

            brasser Michael Brasser (closed Nokia identity) (Inactive)
            brasser Michael Brasser (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes