[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [sink/develop] common: Don't reference temporary memory
From: Christian Mollekopf <chrigi_1 () fastmail ! fm>
Date: 2016-12-02 10:08:34
Message-ID: E1cCkle-0004b8-RZ () code ! kde ! org
[Download RAW message or body]
Git commit 45caa641e429136405194085e50305f7f23e98df by Christian Mollekopf.
Committed on 29/11/2016 at 11:26.
Pushed by cmollekopf into branch 'develop'.
Don't reference temporary memory
M +3 -2 common/commandprocessor.cpp
M +4 -2 common/synchronizer.cpp
https://commits.kde.org/sink/45caa641e429136405194085e50305f7f23e98df
diff --git a/common/commandprocessor.cpp b/common/commandprocessor.cpp
index 8eb0ef1..06ee142 100644
--- a/common/commandprocessor.cpp
+++ b/common/commandprocessor.cpp
@@ -103,7 +103,7 @@ void CommandProcessor::processFlushCommand(const QByteArray \
&data) if (Sink::Commands::VerifyFlushBuffer(verifier)) {
auto buffer = Sink::Commands::GetFlush(data.constData());
const auto flushType = buffer->type();
- const auto flushId = BufferUtils::extractBuffer(buffer->id());
+ const auto flushId = BufferUtils::extractBufferCopy(buffer->id());
if (flushType == Sink::Flush::FlushSynchronization) {
mSynchronizer->flush(flushType, flushId);
} else {
@@ -323,7 +323,8 @@ KAsync::Job<void> CommandProcessor::flush(void const *command, \
size_t size) if (Sink::Commands::VerifyFlushBuffer(verifier)) {
auto buffer = Sink::Commands::GetFlush(command);
const auto flushType = buffer->type();
- const auto flushId = BufferUtils::extractBuffer(buffer->id());
+ const QByteArray flushId = BufferUtils::extractBufferCopy(buffer->id());
+ Q_ASSERT(!flushId.isEmpty());
if (flushType == Sink::Flush::FlushReplayQueue) {
SinkTrace() << "Flushing synchronizer ";
Q_ASSERT(mSynchronizer);
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp
index 6483cdf..036288e 100644
--- a/common/synchronizer.cpp
+++ b/common/synchronizer.cpp
@@ -268,7 +268,8 @@ void Synchronizer::synchronize(const Sink::QueryBase &query)
void Synchronizer::flush(int commandId, const QByteArray &flushId)
{
- SinkTrace() << "Flushing the synchronization queue";
+ Q_ASSERT(!flushId.isEmpty());
+ SinkTrace() << "Flushing the synchronization queue " << flushId;
mSyncRequestQueue << Synchronizer::SyncRequest{Synchronizer::SyncRequest::Flush, \
commandId, flushId}; processSyncQueue().exec();
}
@@ -318,6 +319,7 @@ KAsync::Job<void> Synchronizer::processSyncQueue()
}
});
} else if (request.requestType == Synchronizer::SyncRequest::Flush) {
+ Q_ASSERT(!request.requestId.isEmpty());
if (request.flushType == Flush::FlushReplayQueue) {
SinkTrace() << "Emitting flush completion.";
Sink::Notification n;
@@ -326,7 +328,7 @@ KAsync::Job<void> Synchronizer::processSyncQueue()
emit notify(n);
} else {
flatbuffers::FlatBufferBuilder fbb;
- auto flushId = fbb.CreateString(request.requestId);
+ auto flushId = fbb.CreateString(request.requestId.toStdString());
auto location = Sink::Commands::CreateFlush(fbb, flushId, \
static_cast<int>(Sink::Flush::FlushSynchronization)); \
Sink::Commands::FinishFlushBuffer(fbb, location);
enqueueCommand(Sink::Commands::FlushCommand, \
BufferUtils::extractBuffer(fbb));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic