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

Crash when assigning a function declaration to a ListElement(for nested lists)

XMLWordPrintable

    • Linux/Yocto, Windows

       

      ListModel {
          id: fullTabsModel
          ListElement {
              icon: 'iso/Crop'
              source:"qrc:/settings/CropsComponent.qml";
              active: true
          }
          ListElement {
              icon: 'iso/OperatorManual'
              source:"qrc:/settings/CombineAssistanceComponent.qml";
              active: true
          }
          ListElement {
              icon: 'iso/ServiceIndicator'
              source:"../statistic/MaintenanceComponent.qml";
              active: true
          }
          ListElement {
              icon: 'icons/Setting'
              source:"";
              active: true
              submenu: [
                  ListElement {
                      icon: 'icons/DataTime'
                      source:"qrc:/settings/DateTimeComponent.qml";
                      active: true
                  },
                  ListElement {
                      icon: 'icons/DisplayBrightness'
                      source:"qrc:/settings/ScreenSettingsDialog.qml";
                      active: true
                  },
                  ListElement {
                      icon: 'icons/SoundMenu'
                      source:"qrc:/settings/SoundSettingsDialog.qml";
                      active: true
                  },
                  ListElement {
                      icon: 'icons/NotificationConfiguration'
                      source:"qrc:/settings/NotificationConfigurationComponent.qml";
                      active: true
                  },
                  ListElement {
                      icon: 'icons/Languages'
                      source:"qrc:/settings/LanguageSettingsDialog.qml";
                      active: true
                  },
                  ListElement {
                      icon: 'icons/Password'
                      source:"qrc:/settings/PasswordSettingsDialog.qml";
                      active: true
                      func : function(){}
                  }
              ]
          } 

      This is about function decl. Anyway it doesnt have to be a crash...

      // for now we do not provide a context object; data from the ListElement must be passed to the function                
      QV4::ScopedContext context(scope, QV4::QmlContext::create(v4->rootContext(), QQmlContextData::get(qmlContext(model->m_modelCache)), nullptr));
                      
      QV4::ScopedFunctionObject function(scope, QV4::FunctionObject::createScriptFunction(context, compilationUnit->runtimeFunctions[id]));
        

      I suppose the context model for nested elements that are nested in an array, for example, will be nullptr, the code above does not handle this case in any way. For other types, it's not important to have a null contextual model, but for some reason it's still important for a function. I assumed that the semantics of such a function are not context-related, but they can be, it's not clear to me exactly, even from the documentation, maybe I missed something.

      I think this is really a bug, since it should at least not fall , depending on architectural goals, either passing nullptr instead of trying to take context for functions that are contextually free , or still passing the necessary context there, for example, the parent model.

       

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

            qtqmlteam Qt Qml Team User
            nik_vzdornov Nik_Vzdornov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes