Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. emit a signale twice => ASSERT: "!isEmpty()"

emit a signale twice => ASSERT: "!isEmpty()"

Scheduled Pinned Locked Moved Solved General and Desktop
multiple emitisempty
12 Posts 3 Posters 4.3k Views
  • 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.
  • QT-static-prgmQ Offline
    QT-static-prgmQ Offline
    QT-static-prgm
    wrote on last edited by QT-static-prgm
    #1

    I get this error message:
    ASSERT: "!isEmpty()" in file d:\libraries\qt\msvs15_v5_7_0\include\qtcore\qvector.h, line 238

    When i emit a 2nd time here it gonna crash at this part.

    What is wrong??
    I can emit as often as i like here and i have no problems.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      check the stack trace at the crash point, that assertion is triggered just because you try to access the first element of an empty vector, it's crashing somewhere else

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • QT-static-prgmQ Offline
        QT-static-prgmQ Offline
        QT-static-prgm
        wrote on last edited by
        #3

        i removed that if so i emit always.
        Opening a 2nd file => crash,
        Opening a file with more then one texture => crash,
        Removing the emit line => everything works.
        So i'm pretty sure it's that piece of code causing the problem. But here is my stack

        Qt5Cored.dll!qt_message_fatal(QtMsgType __formal, const QMessageLogContext & context, const QString & message) Zeile 1673 C++
        Qt5Cored.dll!QMessageLogger::fatal(const char * msg, ...) Zeile 793 C++
        Qt5Cored.dll!qt_assert(const char * assertion, const char * file, int line) Zeile 3063 C++
        QtMeshViewer.exe!QVector<QOpenGLTexture *>::last() Zeile 238 C++
        QtMeshViewer.exe!GeometryEngine::drawGeometry(QOpenGLShaderProgram * program) Zeile 212 C++
        QtMeshViewer.exe!OglViewerWidget::paintGL() Zeile 170 C++
        Qt5Widgetsd.dll!QOpenGLWidgetPrivate::invokeUserPaint() Zeile 830 C++
        Qt5Widgetsd.dll!QOpenGLWidgetPrivate::render() Zeile 851 C++
        Qt5Widgetsd.dll!QOpenGLWidget::paintEvent(QPaintEvent * e) Zeile 1204 C++
        Qt5Widgetsd.dll!QWidget::event(QEvent * event) Zeile 8931 C++
        Qt5Widgetsd.dll!QOpenGLWidget::event(QEvent * e) Zeile 1349 C++
        Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Zeile 3799 C++
        Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Zeile 3762 C++
        Qt5Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Zeile 988 C++
        Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Zeile 234 C++
        Qt5Widgetsd.dll!QWidgetPrivate::sendPaintEvent(const QRegion & toBePainted) Zeile 5696 C++
        Qt5Widgetsd.dll!QWidgetPrivate::drawWidget(QPaintDevice * pdev, const QRegion & rgn, const QPoint & offset, int flags, QPainter * sharedPainter, QWidgetBackingStore * backingStore) Zeile 5640 C++
        Qt5Widgetsd.dll!QWidgetPrivate::paintSiblingsRecursive(QPaintDevice * pdev, const QList<QObject *> & siblings, int index, const QRegion & rgn, const QPoint & offset, int flags, QPainter * sharedPainter, QWidgetBackingStore * backingStore) Zeile 5832 C++
        Qt5Widgetsd.dll!QWidgetPrivate::drawWidget(QPaintDevice * pdev, const QRegion & rgn, const QPoint & offset, int flags, QPainter * sharedPainter, QWidgetBackingStore * backingStore) Zeile 5690 C++
        Qt5Widgetsd.dll!QWidgetBackingStore::doSync() Zeile 1365 C++
        Qt5Widgetsd.dll!QWidgetBackingStore::sync() Zeile 1152 C++
        Qt5Widgetsd.dll!QWidgetPrivate::syncBackingStore() Zeile 1957 C++
        Qt5Widgetsd.dll!QWidget::event(QEvent * event) Zeile 9084 C++
        Qt5Widgetsd.dll!QMainWindow::event(QEvent * event) Zeile 1544 C++
        Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Zeile 3799 C++
        Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Zeile 3762 C++
        Qt5Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Zeile 988 C++
        Qt5Cored.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Zeile 231 C++
        Qt5Widgetsd.dll!QWidgetBackingStore::sendUpdateRequest(QWidget * widget, QWidgetBackingStore::UpdateTime updateTime) Zeile 484 C++
        Qt5Widgetsd.dll!QWidgetBackingStore::markDirty(const QRect & rect, QWidget * widget, QWidgetBackingStore::UpdateTime updateTime, QWidgetBackingStore::BufferState bufferState) Zeile 672 C++
        Qt5Widgetsd.dll!QWidget::repaint(const QRect & rect) Zeile 10874 C++
        Qt5Widgetsd.dll!QStatusBar::hideOrShow() Zeile 644 C++
        Qt5Widgetsd.dll!QStatusBar::showMessage(const QString & message, int timeout) Zeile 567 C++
        QtMeshViewer.exe!MainWindow::printMessage(QString message, int severity) Zeile 105 C++
        QtMeshViewer.exe!MainWindow::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Zeile 98 C++
        Qt5Cored.dll!QMetaObject::activate(QObject * sender, int signalOffset, int local_signal_index, void * * argv) Zeile 3740 C++
        Qt5Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Zeile 3602 C++
        QtMeshViewer.exe!GeometryEngine::sendMessage(QString _t1, int _t2) Zeile 189 C++
        QtMeshViewer.exe!GeometryEngine::loadTexture(const char * filePath, const char * fileName) Zeile 134 C++
        QtMeshViewer.exe!GeometryEngine::loadFile(const char * filePath) Zeile 101 C++
        QtMeshViewer.exe!GeometryEngine::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Zeile 99 C++
        Qt5Cored.dll!QMetaObject::activate(QObject * sender, int signalOffset, int local_signal_index, void * * argv) Zeile 3740 C++
        Qt5Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Zeile 3602 C++
        QtMeshViewer.exe!OglViewerWidget::loadFile(const char * t1) Zeile 138 C++
        QtMeshViewer.exe!OglViewerWidget::dropEvent(QDropEvent * e) Zeile 107 C++
        Qt5Widgetsd.dll!QWidget::event(QEvent * event) Zeile 8977 C++
        Qt5Widgetsd.dll!QOpenGLWidget::event(QEvent * e) Zeile 1349 C++
        Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Zeile 3799 C++
        Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Zeile 3556 C++
        Qt5Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Zeile 988 C++
        Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Zeile 234 C++
        Qt5Widgetsd.dll!QWidgetWindow::handleDropEvent(QDropEvent * event) Zeile 873 C++
        Qt5Widgetsd.dll!QWidgetWindow::event(QEvent * event) Zeile 280 C++
        Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Zeile 3799 C++
        Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Zeile 3159 C++
        Qt5Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Zeile 988 C++
        Qt5Cored.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Zeile 231 C++
        Qt5Guid.dll!QGuiApplicationPrivate::processDrop(QWindow * w, const QMimeData * dropData, const QPoint & p, QFlags<enum Qt::DropAction> supportedActions) Zeile 2853 C++
        Qt5Guid.dll!QWindowSystemInterface::handleDrop(QWindow * w, const QMimeData * dropData, const QPoint & p, QFlags<enum Qt::DropAction> supportedActions) Zeile 699 C++
        qwindowsd.dll!QWindowsOleDropTarget::Drop(IDataObject * pDataObj, unsigned long grfKeyState, POINTL pt, unsigned long * pdwEffect) Zeile 636 C++
        [Externer Code]
        [Unten angegebene Rahmen sind möglicherweise nicht korrekt und/oder fehlen, keine Symbole geladen für ole32.dll]
        Qt5Guid.dll!QWindowSystemInterfacePrivate::postWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent * ev) Zeile 403 C++
        Qt5Guid.dll!QWindowSystemInterfacePrivate::handleWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent * ev) Zeile 436 C++
        [Externer Code]
        qwindowsd.dll!QWindowsMouseHandler::translateMouseEvent(QWindow * window, HWND
        * hwnd, QtWindows::WindowsEventType et, tagMSG msg, long * result) Zeile 382 C++
        [Externer Code]
        tiptsf.dll!6d1678bc() Unbekannt
        [Externer Code]
        Qt5Cored.dll!qt_GetMessageHook(int code, unsigned int wp, long lp) Zeile 508 C++
        [Externer Code]
        tiptsf.dll!6d16c2e4() Unbekannt
        [Externer Code]
        Qt5Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Zeile 135 C++
        Qt5Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Zeile 210 C++
        Qt5Cored.dll!QCoreApplication::exec() Zeile 1261 C++
        Qt5Guid.dll!QGuiApplication::exec() Zeile 1640 C++
        Qt5Widgetsd.dll!QApplication::exec() Zeile 2976 C++
        QtMeshViewer.exe!main(int argc, char * * argv) Zeile 12 C++
        [Externer Code]

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          QtMeshViewer.exe!GeometryEngine::drawGeometry(QOpenGLShaderProgram * program) Zeile 212 C++

          the problem is here when m_textures is empty

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          0
          • QT-static-prgmQ Offline
            QT-static-prgmQ Offline
            QT-static-prgm
            wrote on last edited by
            #5

            This is never empty.
            Since it is only executed when the buffers are created
            and if those are created there is always a texture added to that list here

            But why does it only crashes, when i emit that signal?? i see that the stack is currently running that. But when i go through the code with the debugger, it's always here where it crashes

            VRoninV kshegunovK 2 Replies Last reply
            0
            • QT-static-prgmQ QT-static-prgm

              This is never empty.
              Since it is only executed when the buffers are created
              and if those are created there is always a texture added to that list here

              But why does it only crashes, when i emit that signal?? i see that the stack is currently running that. But when i go through the code with the debugger, it's always here where it crashes

              VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              @QT-static-prgm said in emit a signale twice => ASSERT: "!isEmpty()":

              This is never empty.

              Your stack trace disagrees... try adding Q_ASSERT(!m_textures.isEmpty()); before if (it.textureIndex < m_textures.size()) it's free and if I'm wrong and never asserts I'll shut my hole

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              2
              • QT-static-prgmQ Offline
                QT-static-prgmQ Offline
                QT-static-prgm
                wrote on last edited by
                #7

                @VRonin just one question, what should happen, if i add that in this line??

                i think i fixed it by an other way:
                I opened my file the first time and it worked. Then i pressed open file and aboard => Error: file not found is printed via the signal slot connection.
                next i opened my file again (now it should crash), but it does not. I wonder that there are no warnings emit as well, so i debugged and noticed that i did an logical mistake. I could always overwrite Messages in the statusbar, if my severity is higher then the previous. But i forgot about the time out. If there is currently no message i can print every severity. And while i was thinking about the big solution with QTimer and reset the m_currentSeverity variable i found the QStatusbar::currentMessage().isEmpty() function and added it here

                And now everything works fine. So please explain to me, WHY THE HELL did it crash without that?? It still process the same way, since the messages are all same priority, they were previous printed and now they are printed, too. But previous it crash at printing

                VRoninV 1 Reply Last reply
                0
                • QT-static-prgmQ QT-static-prgm

                  This is never empty.
                  Since it is only executed when the buffers are created
                  and if those are created there is always a texture added to that list here

                  But why does it only crashes, when i emit that signal?? i see that the stack is currently running that. But when i go through the code with the debugger, it's always here where it crashes

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by kshegunov
                  #8

                  As my fellow said, this has little to do with any signal emitting. Your QVector<> is empty so it asserts when calling QVector::last():

                  QtMeshViewer.exe!QVector<QOpenGLTexture *>::last() Zeile 238 C++
                  

                  It even specifies where exactly this happens.

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  0
                  • QT-static-prgmQ Offline
                    QT-static-prgmQ Offline
                    QT-static-prgm
                    wrote on last edited by
                    #9

                    But all i changed was changing this: !ui->statusBar->currentMessage().isEmpty() &&
                    and now it works.

                    If you don't believe I haven't changed anything else you can check the git change log: https://git.rwth-aachen.de/carstenf/OpenGL/commit/e963b7538e8ce9fbd706e035e53ab8aef53dae77

                    kshegunovK 1 Reply Last reply
                    0
                    • QT-static-prgmQ QT-static-prgm

                      But all i changed was changing this: !ui->statusBar->currentMessage().isEmpty() &&
                      and now it works.

                      If you don't believe I haven't changed anything else you can check the git change log: https://git.rwth-aachen.de/carstenf/OpenGL/commit/e963b7538e8ce9fbd706e035e53ab8aef53dae77

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by
                      #10

                      Look, I'm not saying it works or it doesn't, or what you changed. I haven't run your code, hell I haven't even looked at your code, just because the stack trace can never lie to you. I trust it with my life and it says you've tripped the assertion on line 212 in GeometryEngine::drawGeometry by calling QVector<QOpenGLTexture *>::last() on a vector that's empty. That's all, so if you change something and this is not happening anymore, then you won't trip the assertion.

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply
                      1
                      • QT-static-prgmQ Offline
                        QT-static-prgmQ Offline
                        QT-static-prgm
                        wrote on last edited by
                        #11

                        I see.
                        The only way i could explain it to me: does showMessage on the statusbar call update on the window??

                        1 Reply Last reply
                        0
                        • QT-static-prgmQ QT-static-prgm

                          @VRonin just one question, what should happen, if i add that in this line??

                          i think i fixed it by an other way:
                          I opened my file the first time and it worked. Then i pressed open file and aboard => Error: file not found is printed via the signal slot connection.
                          next i opened my file again (now it should crash), but it does not. I wonder that there are no warnings emit as well, so i debugged and noticed that i did an logical mistake. I could always overwrite Messages in the statusbar, if my severity is higher then the previous. But i forgot about the time out. If there is currently no message i can print every severity. And while i was thinking about the big solution with QTimer and reset the m_currentSeverity variable i found the QStatusbar::currentMessage().isEmpty() function and added it here

                          And now everything works fine. So please explain to me, WHY THE HELL did it crash without that?? It still process the same way, since the messages are all same priority, they were previous printed and now they are printed, too. But previous it crash at printing

                          VRoninV Offline
                          VRoninV Offline
                          VRonin
                          wrote on last edited by VRonin
                          #12

                          @QT-static-prgm said in emit a signale twice => ASSERT: "!isEmpty()":

                          @VRonin just one question, what should happen, if i add that in this line??

                          • In debug mode you can read Q_ASSERT(condition) as if(!condition){ /*"crash the program"*/;}
                          • In release mode that line is completely ignored

                          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                          ~Napoleon Bonaparte

                          On a crusade to banish setIndexWidget() from the holy land of Qt

                          1 Reply Last reply
                          1

                          • Login

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