X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=3d4303710d81df3eabe39239fa53e2e1ceb71438;hp=e6387f15cdafed963f7eabdfe6d3f453d2046fda;hb=92f256c9ef102ef5af61164bb17b63e501510541;hpb=21e31fe43c4577cad271b070e4df4906ead128d8 diff --git a/src/client/client.cpp b/src/client/client.cpp index e6387f15..3d430371 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -90,6 +90,7 @@ Client::Client(QObject *parent) _debugLog(&_debugLogBuffer) { _signalProxy->synchronize(_ircListHelper); + connect(this, SIGNAL(requestInitialBacklog()), _backlogManager, SLOT(requestInitialBacklog()), Qt::QueuedConnection); } Client::~Client() { @@ -295,24 +296,30 @@ void Client::setSyncedToCore() { connect(bufferSyncer(), SIGNAL(bufferRenamed(BufferId, QString)), this, SLOT(bufferRenamed(BufferId, QString))); connect(bufferSyncer(), SIGNAL(buffersPermanentlyMerged(BufferId, BufferId)), this, SLOT(buffersPermanentlyMerged(BufferId, BufferId))); connect(bufferSyncer(), SIGNAL(buffersPermanentlyMerged(BufferId, BufferId)), _messageModel, SLOT(buffersPermanentlyMerged(BufferId, BufferId))); - connect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog())); connect(networkModel(), SIGNAL(setLastSeenMsg(BufferId, MsgId)), bufferSyncer(), SLOT(requestSetLastSeenMsg(BufferId, const MsgId &))); signalProxy()->synchronize(bufferSyncer()); // create a new BufferViewManager Q_ASSERT(!_bufferViewManager); _bufferViewManager = new ClientBufferViewManager(signalProxy(), this); - connect(bufferViewManager(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog())); connect(bufferViewManager(), SIGNAL(initDone()), this, SLOT(createDefaultBufferView())); + connect(bufferViewManager(), SIGNAL(viewsInitialized()), this, SLOT(requestInitialBacklogBarrier())); _syncedToCore = true; emit connected(); emit coreConnectionStateChanged(true); } -void Client::requestInitialBacklog() { - if(bufferViewManager()->isInitialized() && bufferSyncer()->isInitialized()) - Client::backlogManager()->requestInitialBacklog(); +void Client::requestInitialBacklogBarrier() { + // usually it _should_ take longer until the bufferViews are initialized, so that's what + // triggers this slot. But we have to make sure that we know all buffers yet. + // so we check the BufferSyncer and in case it wasn't initialized we wait for that instead + if(!bufferSyncer()->isInitialized()) { + disconnect(bufferViewManager(), SIGNAL(viewsInitialized()), this, SLOT(requestInitialBacklogBarrier())); + connect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(requestInitialBacklogBarrier())); + return; + } + emit requestInitialBacklog(); } void Client::createDefaultBufferView() {