Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGSEGV when changing state property on QML object #84

Closed
sountharcs opened this issue Aug 19, 2014 · 10 comments
Closed

SIGSEGV when changing state property on QML object #84

sountharcs opened this issue Aug 19, 2014 · 10 comments

Comments

@sountharcs
Copy link

i have created qml file with qt creator and it works very well when i run with QtCreator.But it does not run when i use the same qml file with Go.
i am getting error like this :
SIGSEGV: segmentation violation
PC=0xb65dc472
signal arrived during cgo execution
Its crashing while i move one rectangle to another rectangle's position. Most of the tutorials are working well even gopher example is working well.
i attached you an example. its working well. But if i use rect1.x and rect1.y instead of 50 & 160 its crashing. So the problem is here.
working case :

states: State {
        name: "down";
        PropertyChanges { target: rect1; x:50; y: 160}
    }
crashing :
states: State {
        name: "down";
        PropertyChanges { target: rect1; x:rect2.x; y: rect2.y}
    }


Complete code :


import QtQuick 2.0
Rectangle {
    id: page
    width: 320; height: 480
    color: "lightgray"
    state:"none"
    Rectangle {
        id: rect1
        x: 30
        y: 30
        width:50
        height:50
        MouseArea {
            anchors.fill: parent
            onClicked: page.state = 'down'
        }
    }
    Rectangle {
        id: rect2
        x: 50
        y: 160
        width:50
        height:50
    }
    states: State {
        name: "down";
        PropertyChanges { target: rect1; x:50; y: 160} // if i use rect2.x and rect2.y instead of 50 & 160 its crashing...
    }
    transitions: Transition {
        from: "none"; to: "down";
        NumberAnimation { properties: "x,y"; duration: 2000; easing.type: Easing.InOutQuad }
    }
}
@niemeyer
Copy link
Contributor

This was quickly covered in the mailing list, and I can reproduce the crash. Will have a look after I'm done with the current task.

@sountharcs
Copy link
Author

Hi niemeyer,
Any update on this issue !
This is also not working. But its working well in QtCreator.

import QtQuick 2.0
Rectangle {
    id: rect
    width: 100; height: 100
    color: "red"
    property bool flag : false
    property int edx: 50
    property int edy: 50
    MouseArea {
        id: mouseArea
        anchors.fill: parent
        onClicked: {
            if (flag) {
                rect.state = "moved"
            } else {
                rect.state = "not"
            }
            flag = !flag
        }
    }
    states: [
        State {
            name: "moved";
            PropertyChanges { target: parent; x: edx; y: edy }  // here is problem
        },
        State {
            name: "not";
            PropertyChanges { target: parent; x: 0; y: 0 }
        }
    ]
    transitions: [
        Transition {
            to: "moved"
            NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
        },
        Transition {
            to: "not"
            NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }
        }
    ]
}

@niemeyer
Copy link
Contributor

niemeyer commented Sep 1, 2014

Sorry for being slow on this, Sounthar. As you may be following through the list, I've been pushing the GL APIs in the last couple of weeks. I'll stop and look at your case soon.

Please do let me know if you find any other issues meanwhile.

@niemeyer
Copy link
Contributor

niemeyer commented Sep 5, 2014

So, this is a strange crash. The logic being done by the qml package is not even touching on anything related to the qml file, and the crash happens deep inside Qt itself:

Program received signal SIGSEGV, Segmentation fault.
QV4::FunctionObject::creatScriptFunction (scope=scope@entry=0x7fffe4020500, function=0x0) at jsruntime/qv4functionobject.cpp:187
(gdb) bt
#0  QV4::FunctionObject::creatScriptFunction (scope=scope@entry=0x7fffe4020500, function=0x0) at jsruntime/qv4functionobject.cpp:187
#1  0x00007ffff637ca5b in QQmlBinding::createBinding (id=<optimized out>, obj=0xb516f0, ctxt=ctxt@entry=0xdcb010, url=..., lineNumber=lineNumber@entry=9)
    at qml/qqmlbinding.cpp:95
#2  0x00007ffff6e0204f in QQuickPropertyChanges::actions (this=0x201e1a0) at util/qquickpropertychanges.cpp:482
#3  0x00007ffff6df5500 in QQuickStatePrivate::generateActionList (this=this@entry=0xb51590) at util/qquickstate.cpp:340
#4  0x00007ffff6df5941 in QQuickState::apply (this=this@entry=0xb514e0, trans=trans@entry=0x0, revert=revert@entry=0xb4e200) at util/qquickstate.cpp:579
#5  0x00007ffff6e045bf in QQuickStateGroupPrivate::setCurrentStateInternal (this=0xb51320, state=..., ignoreTrans=ignoreTrans@entry=false) at util/qquickstategroup.cpp:487
#6  0x00007ffff6e04d9b in QQuickStateGroup::setState (this=<optimized out>, state=...) at util/qquickstategroup.cpp:293
#7  0x00007ffff6e7ed75 in QQuickItemPrivate::setState (this=<optimized out>, state=...) at items/qquickitem.cpp:4249
#8  0x00007ffff6e7ed89 in QQuickItem::setState (this=this@entry=0xa885a0, state=...) at items/qquickitem.cpp:4283
#9  0x00007ffff6e8c5f3 in QQuickItem::qt_metacall (this=this@entry=0xa885a0, _c=_c@entry=QMetaObject::WriteProperty, _id=15, _a=_a@entry=0x7fffffffcf20)
    at .moc/moc_qquickitem.cpp:881
#10 0x00007ffff6fa7a57 in QQuickRectangle::qt_metacall (this=0xa885a0, _c=QMetaObject::WriteProperty, _id=<optimized out>, _a=0x7fffffffcf20)
    at .moc/moc_qquickrectangle_p.cpp:556
#11 0x00007ffff62a3e1f in QV4::QObjectWrapper::setProperty (object=0xa885a0, ctx=<optimized out>, property=0x7fffbc038608, value=...) at jsruntime/qv4qobjectwrapper.cpp:535
#12 0x00007ffff62a4265 in QV4::QObjectWrapper::setProperty (this=<optimized out>, ctx=<optimized out>, propertyIndex=<optimized out>, value=...)
    at jsruntime/qv4qobjectwrapper.cpp:646
#13 0x00007ffff62323bf in QV4::__qmljs_set_qobject_property (ctx=<optimized out>, object=..., propertyIndex=<optimized out>, value=...) at jsruntime/qv4runtime.cpp:1319

@niemeyer
Copy link
Contributor

niemeyer commented Sep 5, 2014

The traceback above was obtained with the stock package from Ubuntu 14.04, Qt 5.2.1.

I have tried to reproduce the problem with a local debug build of Qt 5.2.0 and failed. The example worked fine. I'm now doing a debug build of the upstream Qt 5.2.1 to see if it is reproducible.

@niemeyer niemeyer changed the title SIGSEGV: segmentation violation SIGSEGV when changing state property on QML object Sep 5, 2014
@niemeyer
Copy link
Contributor

niemeyer commented Sep 5, 2014

A few more data points: running the reproducer under the debug build of 5.2.1 5.2.0 (see below) also works fine. Not only that, but while using a single built binary and switching the libraries in use via LD_LIBRARY_PATH between the debug build and the Ubuntu-provided libraries will make the example crash (system libraries) and not crash (debug build).

Update: I misbuilt 5.2.1.. missed the update of the submodules, which means I built 5.2.0 again.

@niemeyer
Copy link
Contributor

niemeyer commented Sep 6, 2014

So, the debug build of 5.2.0 works fine, but the debug build of 5.2.1 crashes. That's a good lead. Will spend some more time on this next week.

@niemeyer
Copy link
Contributor

niemeyer commented Sep 9, 2014

Okay, found the problem. It's indeed a bug in Qt, for which I provided a detailed report upstream:

Now let's see how to workaround it so we're not touching the problem.

@sountharcs
Copy link
Author

hi Gustavo,

Thanks for your effort to find the issue. lets hope for the best .

On Tue, Sep 9, 2014 at 10:10 AM, Gustavo Niemeyer notifications@github.com
wrote:

Okay, found the problem. It's indeed a bug in Qt, for which I provided a
detailed report upstream:

Now let's see how to workaround it so we're not touching the problem.


Reply to this email directly or view it on GitHub
#84 (comment).

@niemeyer
Copy link
Contributor

niemeyer commented Sep 9, 2014

I will workaround the issue locally in the qml package no matter what, as the upstream fix will not be around for quite some time, even if it lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants