From: Manuel Nickschas Date: Tue, 26 Aug 2008 22:23:09 +0000 (+0200) Subject: Replace segfault by big fat warning X-Git-Tag: 0.3.0~8 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=3d3f7cc562435d32561a13a07dd6b31609b8391d Replace segfault by big fat warning In theory, this can never happen, but for some bizarre reason, mikkoc still managed to trigger a segfault :) If you ever happen to find a way to reliably reproduce this, please let us know. --- diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index 488a91d6..3f9289ce 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -59,7 +59,7 @@ ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, QObject this, SLOT(rowsInserted(const QModelIndex &, int, int))); connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int))); - + for(int i = 0; i < model->rowCount(); i++) { ChatLine *line = new ChatLine(i, model); _lines.append(line); @@ -278,10 +278,12 @@ void ChatScene::updateSelection(const QPointF &pos) { _lastSelectionRow = curRow; if(newstart == newend && minColumn == ChatLineModel::ContentsColumn) { + if(!_selectingItem) { + qWarning() << "WARNING: ChatScene::updateSelection() has a null _selectingItem, this should never happen! Please report."; + return; + } _lines[curRow]->setSelected(false); _isSelecting = false; - Q_ASSERT(_selectingItem); // this seems to not always be true, but I have no idea why - // adding this assert to make sure the occasional segfault is caused by this _selectingItem->continueSelecting(_selectingItem->mapFromScene(pos)); } }