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. Qut of memory in QVector
Forum Updated to NodeBB v4.3 + New Features

Qut of memory in QVector

Scheduled Pinned Locked Moved Solved General and Desktop
runtime error
14 Posts 4 Posters 4.2k Views 2 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.
  • T Tikani

    @jsulm yes, I tried, but error happens inside the Qt class, not in my code, so, debugger shows me an ugly assembler code. As far I understand, I need to rebuild the whole Qt with debug information/symbols to be able to get human-friendly debuggin proccess. I use Windows and default build environment from the opensource installator from the official Qt site (Qt 5.9.6 or Qt 5.11, MinGW 5.3.0 32bit) and rebuild Qt from source not under Linux - such a pain.

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by jsulm
    #4

    @Tikani But it could help to see where in your app you are when the crash happens and in which state the app is (values of variables, ...). Bugs in frameworks are rare, so most probably it is something in your app, but actual crash happens inside Qt (but not because of a Qt bug).

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    T 1 Reply Last reply
    0
    • jsulmJ jsulm

      @Tikani But it could help to see where in your app you are when the crash happens and in which state the app is (values of variables, ...). Bugs in frameworks are rare, so most probably it is something in your app, but actual crash happens inside Qt (but not because of a Qt bug).

      T Offline
      T Offline
      Tikani
      wrote on last edited by Tikani
      #5

      @jsulm Ok, then I try to rebuild Qt with debug information and post here a link to GitHub with my project (it's opensource) as well, may be then things get clearer for true Jedis :D may be there is a need in a big picture to resolve the problem.

      jsulmJ 2 Replies Last reply
      0
      • T Tikani

        @jsulm Ok, then I try to rebuild Qt with debug information and post here a link to GitHub with my project (it's opensource) as well, may be then things get clearer for true Jedis :D may be there is a need in a big picture to resolve the problem.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #6

        @Tikani No! There is no need to rebuild Qt at this stage! I don't ask you to debug Qt - it will most probably not help you. Simply run your app through debugger until it crashes and see where in your app you are at that time.
        In most cases (from my own experience) if your app crashes somewhere in Qt it is NOT Qt but your app which is doing something wrong.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • T Tikani

          @jsulm Ok, then I try to rebuild Qt with debug information and post here a link to GitHub with my project (it's opensource) as well, may be then things get clearer for true Jedis :D may be there is a need in a big picture to resolve the problem.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #7

          @Tikani Also you can post stack trace after crash here - it can help to find the issue

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          T 1 Reply Last reply
          2
          • jsulmJ jsulm

            @Tikani Also you can post stack trace after crash here - it can help to find the issue

            T Offline
            T Offline
            Tikani
            wrote on last edited by Tikani
            #8

            @jsulm OK, I got the point. I attach stacktrace and full code a little bit later - I need to go to work now :( Thanks anyway for the fastness of responses - now I'm confident that my issue would be resolved eventually with help of the community.

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #9

              Hi
              I see that you are using 32 bit.
              How many model items do you add ?

              1 Reply Last reply
              1
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #10

                Hi,

                @Tikani said in Qut of memory in QVector:

                QList<Task> *tasks = nullptr; // Внутреннее хранилище всех задач

                Why are you using a pointer for tasks ? I don't see it initialised anywhere.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                T 1 Reply Last reply
                2
                • SGaistS SGaist

                  Hi,

                  @Tikani said in Qut of memory in QVector:

                  QList<Task> *tasks = nullptr; // Внутреннее хранилище всех задач

                  Why are you using a pointer for tasks ? I don't see it initialised anywhere.

                  T Offline
                  T Offline
                  Tikani
                  wrote on last edited by Tikani
                  #11

                  @SGaist It is just an inner storage over which subclassed model works. I forgot to comment it after my experiments with fields and its types, when I tried to locate a culprit of a aprogram crash. Anyway, it doesn't initialize in any way, it is just empty nullptr junk pointer.
                  By the way, here stacktrace comes:

                  1  msvcrt!abort                                                                        0x7732b3fb 
                  2  libstdc++-6!_ZN9__gnu_cxx27__verbose_terminate_handlerEv                            0x1768085d 
                  3  libstdc++-6!_ZN10__cxxabiv111__terminateEPFvvE                                      0x17679399 
                  4  libstdc++-6!_ZSt9terminatev                                                         0x17713930 
                  5  qt_check_pointer                                         qglobal.cpp           3050 0x6b98abc1 
                  6  QVector<QHeaderViewPrivate::SectionItem>::reallocData    qvector.h             551  0xde2dc07  
                  7  QVector<QHeaderViewPrivate::SectionItem>::resize         qvector.h             416  0xde2e4ce  
                  8  QHeaderViewPrivate::createSectionItems                   qheaderview.cpp       3530 0xdcd1a3d  
                  9  QHeaderView::initializeSections                          qheaderview.cpp       2279 0xdcd2572  
                  10 QHeaderView::initializeSections                          qheaderview.cpp       2205 0xdcd5918  
                  11 QHeaderView::reset                                       qheaderview.cpp       1774 0xdcd9584  
                  12 QAbstractItemView::setModel                              qabstractitemview.cpp 748  0xdcc0764  
                  13 QHeaderView::setModel                                    qheaderview.cpp       408  0xdcd94e0  
                  14 QTableView::setModel                                     qtableview.cpp        1136 0xdd140d6  
                  15 MainWindow::MainWindow                                   mainwindow.cpp        15   0x401910   
                  16 qMain                                                    main.cpp              11   0x4016f4   
                  17 WinMain *16                                              qtmain_win.cpp        104  0x404d85   
                  18 main                                                                                0x40934d   
                  
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    One more thing, your data method is empty, it should at least contain return QVariant();.

                    You don't need to pass your QApplication instance as parameter. You can access it using the qApp macro.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    T 1 Reply Last reply
                    3
                    • SGaistS SGaist

                      One more thing, your data method is empty, it should at least contain return QVariant();.

                      You don't need to pass your QApplication instance as parameter. You can access it using the qApp macro.

                      T Offline
                      T Offline
                      Tikani
                      wrote on last edited by
                      #13

                      @SGaist Thanks, the issue is solved. There was a need in return QVariant() indeed. Mark as closed.

                      1 Reply Last reply
                      1
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #14

                        There's always a need to return something when your method has a return type. If you don't know what to return at first then return a default value.

                        Also, always take into account the warnings the compiler throws at you (there is one for functions not returning anything when their signature contains a return type). As the old saying goes: a compiler warning ignored today is a catastrophic crash in production tomorrow.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        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