Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Segmentation fault occurs when using createObject() call.

Segmentation fault occurs when using createObject() call.

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sivabalan
    wrote on 7 Jul 2011, 12:40 last edited by
    #1

    Hi,

    I have a slider control and a list view in the same application page, and whenever the current value of the slider is changed the listview gets a new ListModel (each element of this list has a subListModel as an attribute that is created and populated by a Javascript function). And a global dictionary is updated with sliderValue:ListModel pairs for each of the operations above. The application crashes with a segmentation fault randomly when the slider control is moved around to generate new lists.

    @QML File:

    Component {
    id: listModel
    ListModel{}
    }

    Slider{
    id: slider
    onValueChanged: { Script.createModels(value,mainListModel,listModel); }
    }

    ListView{
    model: Script.modelCache[slider.value]
    }

    Script.js file:

    .pragma library

    var modelCache=new Object;

    function createModels(sValue,mainList,qmlListModel){
    var newObj=qmlListModel.createObject(null);

      // Populate newObj iteratively with values from a HTTP Request
              mainList.append({ resultObject: newObj }) // add to main list
    
       modelCache[sValue]=mainList;
    

    }

    Backtrace from GDB:

    #0 QDeclarativeObjectScriptClass::newQObject (this=0xb04a8, object=0x7d28f0, type=136) at qml/qdeclarativeobjectscriptclass.cpp:117
    #1 0x3b103a88 in QDeclarativeEnginePrivate::scriptValueFromVariant (this=0x66898, val=...) at qml/qdeclarativeengine.cpp:2082
    #2 0x3b1c8870 in QDeclarativeObjectScriptClass::property (this=0xb04a8, obj=0x86a210, name=<value optimized out>) at qml/qdeclarativeobjectscriptclass.cpp:312
    #3 0x3b1c8b00 in QDeclarativeObjectScriptClass::property (this=0xb04a8, object=<value optimized out>, name=@0xaeabcec4) at qml/qdeclarativeobjectscriptclass.cpp:210
    #4 0x3d62b814 in QScript::DeclarativeObjectDelegate::getOwnPropertySlot (this=0x75b5d8, object=<value optimized out>, exec=0x40c24024, propertyName=<value optimized out>, slot=...)
    at bridge/qscriptdeclarativeobject.cpp:76
    #5 0x3d6103ec in QScriptObject::getOwnPropertySlot (this=0x40e78de0, exec=0x40c24024, propertyName=..., slot=<value optimized out>) at bridge/qscriptobject.cpp:61
    #6 0x3d4c199c in QTJSC::JSValue::get(QTJSC::ExecState*, QTJSC::Identifier const&, QTJSC::PropertySlot&) const () from /usr/lib/libQtScript.so.4
    #7 0x3d4f791c in QTJSC::JITStubThunked_op_get_by_id (args=<value optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp:1364
    #8 0x3d4f0764 in cti_op_get_by_id () from /usr/lib/libQtScript.so.4
    #9 0x3d4f0764 in cti_op_get_by_id () from /usr/lib/libQtScript.so.4@

    Could anyone tell me what's going wrong here or a better way to accomplish this??

    Thanks in advance,
    Siva

    1 Reply Last reply
    0

    1/1

    7 Jul 2011, 12:40

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved