Fix rooting hazard in ImageBitmap::CreateInternal by avoiding movable data.
parent
8a7d4550aa
commit
7040645be7
|
@ -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…
Reference in New Issue