Replace segfault by big fat warning
[quassel.git] / src / qtui / chatscene.cpp
index 3b01d0d..3f9289c 100644 (file)
@@ -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);
@@ -75,8 +75,11 @@ ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, QObject
   secondColHandlePos = s.value(QString("ChatView/%1/SecondColumnHandlePos").arg(_idString),
                                 defaultSecondColHandlePos).toInt();
 
-  firstColHandle = new ColumnHandleItem(QtUi::style()->firstColumnSeparator()); addItem(firstColHandle);
-  secondColHandle = new ColumnHandleItem(QtUi::style()->secondColumnSeparator()); addItem(secondColHandle);
+  firstColHandle = new ColumnHandleItem(QtUi::style()->firstColumnSeparator());
+  addItem(firstColHandle);
+
+  secondColHandle = new ColumnHandleItem(QtUi::style()->secondColumnSeparator());
+  addItem(secondColHandle);
 
   connect(firstColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(handlePositionChanged(qreal)));
   connect(secondColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(handlePositionChanged(qreal)));
@@ -275,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));
   }
 }