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

QTableWidget crash when dragging an item with QVariant<void*> UserRole data

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P1: Critical
    • None
    • 5.7.1
    • Widgets: Itemviews
    • None
    • Crashes under Windows 7, 32-bit

      Under macOS Sierra with Qt 5.7.0 it doesn't crash, but it produces this error:

      {noformat}
      QVariant::save: unable to save type 'void*' (type id: 31).
      {noformat}

    Description

      The following code sample crashes when a user starts dragging a row:

      #include <QApplication>
      #include <QTableWidget>
      
      int main(int argc, char *argv[])
      {
      	QApplication a(argc, argv);
      	
      	QTableWidget qt;
      	qt.setDragDropMode(QTableWidget::InternalMove);
      	qt.setColumnCount(1);
      	qt.setRowCount(6);
      	for (int rowIdx = 0; rowIdx < qt.rowCount(); ++rowIdx) {
      		qt.setItem(rowIdx, 0, new QTableWidgetItem(QString::number(rowIdx)));
      		qt.item(rowIdx, 0)->setData(Qt::UserRole, QVariant::fromValue<void*>((void*)0));
      	}
      	qt.show();
      
      	return a.exec();
      }
      

      Additionally, the following error is produced:

      QVariant::save: unable to save type 'void*' (type id: 31).
      
      ASSERT failure in QVariant::save: "Invalid type to save", file kernel\qvariant.cpp, line 2144
      Invalid parameter passed to C runtime function.
      Invalid parameter passed to C runtime function.
      

      A few additional notes:

      • I see the same error when I use QObject* instead (only with a different type id in the error message)
      • I see the same error when I use a non-null pointer value
      • I don't see the same error when storing an int, long, etc...

      Running in debug doesn't yield a stack trace on crash.

      Attachments

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

        Activity

          People

            richard Richard Moe Gustavsen
            bejibbers bejibbers
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes