Segmentation fault occurs when using createObject() call.
-
wrote on 7 Jul 2011, 12:40 last edited by
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/1