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

Windows: std::bad_alloc catch causing segfault

    XMLWordPrintable

Details

    Description

      Catching std::bad_alloc exception on Windows fails with segfault with the attached example application.

      The same application works fine on Linux and the exception is catched. Also catching bad_alloc with std::vector without any Qt components works fine on Windows.

      The issue appears to be that data is 0x0 in qarraydata.h deallocate function.

      qarraydata.h:
      static void deallocate(QArrayData *data)
      data = 0x0;
      
      Backtrace:    
      0	load<int>	qgenericatomic.h	96	0x6ba3ea3a	
      1	QBasicAtomicInteger<int>::load	qbasicatomic.h	142	0x6ba3ea3a	
      2	QtPrivate::RefCount::isStatic	qrefcount.h	86	0x6ba56d9f	
      3	QArrayData::deallocate	qarraydata.cpp	124	0x6b798d2e	
      4	QTypedArrayData<int>::deallocate	qarraydata.h	230	0x407fcf	
      5	QVector<int>::reallocData	qvector.h	504	0x4091c4	
      6	QVector<int>::append	qvector.h	564	0x4092c1	
      7	QVector<int>::push_back	qvector.h	210	0x409381	
      8	MainWindow::causeBadAlloc	mainwindow.cpp	24	0x40191c	
      9	MainWindow::qt_static_metacall	moc_mainwindow.cpp	67	0x401965	
      10	QMetaObject::activate	qobject.cpp	3569	0x6b946890	
      11	QMetaObject::activate	qobject.cpp	3444	0x6b946232	
      12	QAbstractButton::clicked	moc_qabstractbutton.cpp	294	0x2220353	
      13	QAbstractButtonPrivate::emitClicked	qabstractbutton.cpp	542	0x1ffc111	
      14	QAbstractButtonPrivate::click	qabstractbutton.cpp	535	0x1ffc0ac	
      15	QAbstractButton::mouseReleaseEvent	qabstractbutton.cpp	1140	0x1ffd3a1	
      16	QWidget::event	qwidget.cpp	7946	0x1f3e10b	
      17	QAbstractButton::event	qabstractbutton.cpp	1097	0x1ffd216	
      18	QPushButton::event	qpushbutton.cpp	681	0x208710c	
      19	QApplicationPrivate::notify_helper	qapplication.cpp	3482	0x1f0deb1	
      20	QApplication::notify	qapplication.cpp	3016	0x1f0bea3	
      21	QCoreApplication::notifyInternal	qcoreapplication.cpp	881	0x6b91b91c	
      22	QCoreApplication::sendSpontaneousEvent	qcoreapplication.h	235	0x22519f1	
      23	QApplicationPrivate::sendMouseEvent	qapplication.cpp	2503	0x1f0ab77	
      24	QWidgetWindow::handleMouseEvent	qwidgetwindow.cpp	491	0x1f560ef	
      25	QWidgetWindow::event	qwidgetwindow.cpp	173	0x1f5517b	
      26	QApplicationPrivate::notify_helper	qapplication.cpp	3482	0x1f0deb1	
      27	QApplication::notify	qapplication.cpp	2903	0x1f0b7cd	
      28	QCoreApplication::notifyInternal	qcoreapplication.cpp	881	0x6b91b91c	
      29	QCoreApplication::sendSpontaneousEvent	qcoreapplication.h	235	0xa03a811	
      30	QGuiApplicationPrivate::processMouseEvent	qguiapplication.cpp	1587	0x9d9bad0	
      31	QGuiApplicationPrivate::processWindowSystemEvent	qguiapplication.cpp	1398	0x9d9b24c	
      32	QWindowSystemInterface::sendWindowSystemEvents	qwindowsysteminterface.cpp	575	0x9d908b2	
      33	QWindowsGuiEventDispatcher::sendPostedEvents	qwindowsguieventdispatcher.cpp	89	0x6285dcb3	
      34	qt_internal_proc	qeventdispatcher_win.cpp	421	0x6b964fc8	
      35	USER32!OffsetRect	C:\WINDOWS\syswow64\user32.dll		0x755a62fa	
      36	??			0x1e045a	
      37	??			0x401	
      38	??				
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            kileppal Kimmo Leppälä
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes