Application is getting crashed ..while adding elements to QTableView



  • I have used QTableView to display my result value and i have QlistWidget to select which result should be displayed in my QTableView.

    here is the code ..
    @

    void CResultModel::listSelected(QModelIndex& index)
    {
    int nRow = index.row();
    if( m_listResults.size() > nRow )
    {
    CResult *result = m_listResults.at( nRow );
    if( result )
    {

                 QList<CMyResult* > item = result->m_listMyResult ;
                 addItems( items );
          }
     }
    

    }

    void CResultModel::addItems( QList<CMyResult*> items )
    {
    clearAll();

    beginInsertRows(QModelIndex(), 0, items.size() -1 );
    m_listMyResult = items;
    endInsertRows();
    }

    void CResultModel::clearAll()
    {
    if ( m_listMyResult.size() > 0 )
    {
    beginRemoveRows(QModelIndex(), 0, m_listMyResult.size() -1 );
    m_listMyResult.clear()
    endRemoveRows();
    }
    }

    @

    From this code i am able to see my different result in my QtableView...but after certain time...my Application is getting crashed... even if i didnt do any operation in my application...

    finally its showing the error on
    @
    inline bool QBasicAtomicInt::ref()
    {
    unsigned char ret;
    asm volatile("lock\n"
    "incl %0\n"
    "setne %1"
    : "=m" (_q_value), "=qm" (ret)
    : "m" (_q_value)
    : "memory");
    return ret != 0;
    } @

    Please let me know..whether i am doing anything wrong on this...



  • Silly question: are you sure there is not a delete somewhere that is causing the crash? Usually this happens if you reference a memory location that no longer exists (or never existed).


Log in to reply
 

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