mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
Fix rooting hazard in ImageBitmap::CreateInternal by avoiding movable data.
This commit is contained in:
parent
ef906c715e
commit
9b6e17cf34
1 changed files with 6 additions and 2 deletions
|
|
@ -952,13 +952,17 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, ImageData& aImageData,
|
|||
|
||||
// Create and Crop the raw data into a layers::Image
|
||||
RefPtr<layers::Image> data;
|
||||
|
||||
// The data could move during a GC; copy it out into a local buffer.
|
||||
uint8_t* fixedData = array.Data();
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
data = CreateImageFromRawData(imageSize, imageStride, FORMAT,
|
||||
array.Data(), dataLength,
|
||||
fixedData, dataLength,
|
||||
aCropRect);
|
||||
} else {
|
||||
RefPtr<CreateImageFromRawDataInMainThreadSyncTask> task
|
||||
= new CreateImageFromRawDataInMainThreadSyncTask(array.Data(),
|
||||
= new CreateImageFromRawDataInMainThreadSyncTask(fixedData,
|
||||
dataLength,
|
||||
imageStride,
|
||||
FORMAT,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue