From 1173db1aa89094003a477933fd6fb6877fc3292f Mon Sep 17 00:00:00 2001
From: Syping <schiedelrafael@keppe.org>
Date: Sun, 8 Jan 2023 18:34:47 +0100
Subject: [PATCH] RagePhoto: avoid setData() replacing it's own RagePhotoData

---
 src/RagePhoto.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/RagePhoto.cpp b/src/RagePhoto.cpp
index 90a982e..8a2c063 100644
--- a/src/RagePhoto.cpp
+++ b/src/RagePhoto.cpp
@@ -939,6 +939,9 @@ inline void RagePhoto::setBufferOffsets(RagePhotoData *ragePhotoData)
 
 bool RagePhoto::setData(RagePhotoData *ragePhotoData, bool takeOwnership)
 {
+    if (m_data == ragePhotoData)
+        return true;
+
     if (takeOwnership) {
         std::free(m_data->jpeg);
         std::free(m_data->description);