From: Manuel Nickschas Date: Tue, 15 Sep 2009 12:09:31 +0000 (+0200) Subject: Don't crash on creating a ChatView containing redirected messages X-Git-Tag: 0.5-rc2~35 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=94c9ed4adf7bbdc5a4f9a7a5f195b0b1d233caf3 Don't crash on creating a ChatView containing redirected messages We must fill the model first before we connect the dataChanged() signal, because message filters might setData() while populating proxymodels. --- diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index 19f48ff2..411cdb85 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -92,15 +92,15 @@ ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, qreal w setHandleXLimits(); + if(model->rowCount() > 0) + rowsInserted(QModelIndex(), 0, model->rowCount() - 1); + connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(rowsInserted(const QModelIndex &, int, int))); connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int))); connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(dataChanged(QModelIndex, QModelIndex))); - if(model->rowCount() > 0) - rowsInserted(QModelIndex(), 0, model->rowCount() - 1); - #ifdef HAVE_WEBKIT webPreview.timer.setSingleShot(true); connect(&webPreview.timer, SIGNAL(timeout()), this, SLOT(webPreviewNextStep()));