Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-93611

std::bad_alloc exception when creating QQuickWidget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.15.2
    • Quick: Widget
    • None
    • Windows

    Description

      I'm trying to convert a part of an existing Qt QWidget application to QML.

      And for this, I'm using QQuickWidget as per the code mentioned here.

      I'm having the below code in the constructor of my main widget (QWidget):

      QQuickWidget *view = new QQuickWidget();

      view->setSource(QUrl::fromLocalFile(":/qml/spinner.qml"));

      view->show();

       

      At times the code works. But some other time, it throws exception in this line:

      QQuickWidget *view = new QQuickWidget();

       

      Exception says:

      Unhandled exception at 0x00007FFC84314B59 in app.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x000000338BCFDEE0.

       

      I don't have a clue why the exception is happening or why it works at times. I haven't been able to find a pattern so far on when it works and when it doesn't.

       

      What else I have tried so far:

      • Other overloads of the constructor for QQuickWidget (doesn't make any difference)
      • Tried using QQuickView (now the exception gets thrown in QQuickView constructor)

       

      From what I understand, this exception happens when the system is running on low RAM. But I have many gigs of RAM free in my system.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tvete Paul Olav Tvete
            bjohns Boney Johns
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes