From 94c9ed4adf7bbdc5a4f9a7a5f195b0b1d233caf3 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Tue, 15 Sep 2009 14:09:31 +0200 Subject: [PATCH] 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. --- src/qtui/chatscene.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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())); -- 2.20.1