Std::__non_rtti_object is thrown in QAbstractItemModel::endResetModel()



  • Hello

    I recently switched compiler from MinGW to MSVC.
    I have now a bug on a code that worked fine with MinGW.

    The runtime throws a std::__non_rtti_object exception when I call endResetModel();

    I built Qt5 from git with rtti enabled. My code is also compiled with RTTI enabled.
    (I get the same exception when using the official binary release 5.0.2 for MSVC2010 and opengl)

    @
    // my code
    void
    ResultTableModel::setSim(Sim *sim) {
    if (sim_ != sim) {
    beginResetModel();
    sim_ = sim;
    endResetModel(); // <- exception is thrown here.
    }
    }

    // Qt's code (qtbase\src\corelib.moc\debug_shared\moc_qabstractitemmodel.cpp)
    // SIGNAL 18
    void QAbstractItemModel::modelReset(QPrivateSignal)
    {
    QMetaObject::activate(this, &staticMetaObject, 18, 0); // <- exception is thrown here.
    }
    @

    I get the Sim object from a dynamic_cast, however the debugger tells me that all the objects are valid (either sim or any other object I checked in the call stack).
    If I comment out endResetModel(), the exception is not thrown.
    And my code works perfectly with MinGW

    moreover, I get the following debug output:
    @
    First-chance exception at 0x102fd5cd (msvcr100d.dll) in MyProgram.exe: 0xC0000005: Access violation reading location 0xfeeefeea.
    First-chance exception at 0x7c812afb in MyProgram.exe: Microsoft C++ exception: std::__non_rtti_object at memory location 0x0012b7bc..
    Unhandled exception at 0x7c812afb in MyProgram.exe: Microsoft C++ exception: std::__non_rtti_object at memory location 0x0012b7bc..
    @

    1. I can't figure out what is at the location 0x0012b7bc. The first object I build (QApplication) is at location 0x0012ff50 (heap objects are somewhere in 0x09xxxxxx)
    2. There seems to be another exception first (access violation somewhere) but I don't know how to break on that one.

    It may not be Qt related, but I'm not sure.
    I'm completely stuck on that one! Any help or hint about where to look at will be appreciated
    thanks !



  • // euhh (shame on me)

    I managed to break on the access violation (that wasn't so hard) and solved my problem.

    definitly not Qt related. Pure home brew bug ! (I had to tweak some parts of the code to make it compilable with msvc)
    sorry for the noise.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.