Use swap for some cases instead move assign. 49/322449/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 9 Apr 2025 07:18:52 +0000 (16:18 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 9 Apr 2025 07:18:52 +0000 (16:18 +0900)
Since library don't make sure that moved std::vector container is cleared.

To make ensure, let we use std::vector::swap() instead move assign with clear.

Change-Id: I88742bc6cea8f32f15db6e733278f103467792e6
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/update/queue/update-message-queue.cpp

index 300b17808cf73a589c06cc5a47801abad296738c..6475c81f5cbf1daf55308993d7bc641ca05ccb33 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@
 #include <dali/internal/update/queue/update-message-queue.h>
 
 // EXTERNAL INCLUDES
-#include <future> ///< for std::future and std::promise
 #include <chrono> ///< for std::chrono::milliseconds
+#include <future> ///< for std::future and std::promise
 
 // INTERNAL INCLUDES
 #include <dali/devel-api/threading/mutex.h>
@@ -292,7 +292,7 @@ bool MessageQueue::ProcessMessages(BufferIndex updateBufferIndex)
 
     mImpl->queueWasEmpty = mImpl->processQueue.empty(); // Flag whether we processed anything
 
-    copiedProcessQueue = std::move(mImpl->processQueue); // Move message queue
+    copiedProcessQueue.swap(mImpl->processQueue); // Move message queue
 
     if(DALI_UNLIKELY(copiedProcessQueue.size() >= MAX_MESSAGES_ALLOWED_IN_PROCESS_QUEUE))
     {