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

Crash happens when an exception occurs while appending QVariant item to a QList

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P2: Important P2: Important
    • None
    • 4.6.0
    • None
    • None
    • S60 emulator.

      With the following test application std::bad_alloc exception is thrown while appending QVariant item to a QList. Exception is first caught successfully in QList<T>::append from where it's rethrown. For some reason rethrown exception is not caught in main() but program panics with KERN-EXEC 3. Same code works as expected e.g. with some custom type.

      #include <QList>
      #include <QVariant>
      
      static bool gOomSimulationEnabled = false;
      
      void* operator new(std::size_t sz) __THROW(std::bad_alloc)
      {
          if (gOomSimulationEnabled) {
              qBadAlloc();
          }
          return qMalloc(sz);
      }
      
      void operator delete(void* memoryAddr) throw()
      {
          if (memoryAddr) {
              qFree(memoryAddr);
          }
      }
      
      int main(int argc, char *argv[]) 
      {
          try {
              gOomSimulationEnabled = true;
              QList<QVariant> list;
              list << QVariant(1);
          } catch (...) {
              int breakPoint = 1;
          }
      }
      

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

            mread Murray Read
            tuomaspiirainen Tuomas Piirainen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes