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. Heap Corruption when using desktop components
Qt 6.11 is out! See what's new in the release blog

Heap Corruption when using desktop components

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 2.4k Views 1 Watching
  • 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
    steno
    wrote on last edited by
    #1

    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
    }
    

    }

    @

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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();
      @

      1 Reply Last reply
      0
      • S Offline
        S Offline
        steno
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          [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.

          1 Reply Last reply
          0

          • Login

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