mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
lottie/slot: fix image deep copy logic
When the datas are copied with deep copy, memory issue caused (SEGV on unknown address) due to these reasons: 1. `mimeType` is nullptr when it's not embedded(base64) data 2. datas(b64Data, mimeType) should not be clear, it's used for next slot copy in same pair.
This commit is contained in:
parent
ca3c0949b0
commit
02a28bf9c3
1 changed files with 5 additions and 4 deletions
|
@ -946,18 +946,19 @@ struct LottieBitmap : LottieProperty
|
|||
if (shallow) {
|
||||
b64Data = rhs.b64Data;
|
||||
mimeType = rhs.mimeType;
|
||||
|
||||
rhs.b64Data = nullptr;
|
||||
rhs.mimeType = nullptr;
|
||||
} else {
|
||||
//TODO: optimize here by avoiding data copy
|
||||
TVGLOG("LOTTIE", "Shallow copy of the image data!");
|
||||
b64Data = duplicate(rhs.b64Data);
|
||||
mimeType = duplicate(rhs.mimeType);
|
||||
if (rhs.mimeType) mimeType = duplicate(rhs.mimeType);
|
||||
}
|
||||
|
||||
size = rhs.size;
|
||||
width = rhs.width;
|
||||
height = rhs.height;
|
||||
|
||||
rhs.b64Data = nullptr;
|
||||
rhs.mimeType = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue