Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Heap Corruption when using desktop components



  • Has anyone seen a heap corruption when using the desktop components with Qt 5.1 rc1 msvc2010 _opengl?

    The following code causes a heap corruption in vs2010 when closing the window. I don't see anything that I am doing wrong.

    The c++ code
    @
    #include <QApplication>
    #include <QQmlApplicationEngine>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    QQmlApplicationEngine engine;

    engine.load(QUrl("DesktopControls.qml"));
    
    return a.exec&#40;&#41;;
    

    }
    @

    The QML code
    @
    import QtQuick 2.1
    import QtQuick.Controls 1.0
    import QtQuick.Window 2.1

    ApplicationWindow {
    title: qsTr("Hello World")
    width: 640
    height: 480
    visible: true

    Button {
        text: qsTr("Hello World")
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
    }
    

    }

    @



  • try this or just find the examples provided by the QtCreator

    @
    QQmlApplicationEngine engine(QUrl("DesktopControls.qml"));
    QObject *topLevel = engine.rootObjects().value(0);
    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
    if ( !window ) {
    qWarning("Error: Your root item has to be a Window.");
    return -1;
    }
    window->show();
    @



  • I used the examples given from Qt. I used the visual studio plugin to open a pro file and then compiled and ran. The examples cause a heap corruption in vs2010 for me; however, in QtCreator it seems to work fine.



  • [quote author="steno" date="1372809062"]I used the examples given from Qt. I used the visual studio plugin to open a pro file and then compiled and ran. The examples cause a heap corruption in vs2010 for me; however, in QtCreator it seems to work fine.[/quote]

    I don't know vs series(vs2010, 12 and so on) very well, since the project work fine under
    QtCreator, then I would guess that the problem maybe is lying
    in your make file.


Log in to reply