Bug 583205 - Crash at the time of download completion. r=karlt,a=blocker

This commit is contained in:
Bobby Holley 2010-07-31 13:44:23 -04:00
Родитель 42e8da7d27
Коммит f207e2e08d
1 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -69,9 +69,21 @@ GdkPixbuf*
nsImageToPixbuf::ImageToPixbuf(imgIContainer* aImage)
{
nsRefPtr<gfxImageSurface> frame;
aImage->CopyFrame(imgIContainer::FRAME_CURRENT,
imgIContainer::FLAG_SYNC_DECODE,
getter_AddRefs(frame));
nsresult rv = aImage->CopyFrame(imgIContainer::FRAME_CURRENT,
imgIContainer::FLAG_SYNC_DECODE,
getter_AddRefs(frame));
// If the last call failed, it was probably because our call stack originates
// in an imgIDecoderObserver event, meaning that we're not allowed request
// a sync decode. Presumably the originating event is something sensible like
// OnStopFrame(), so we can just retry the call without a sync decode.
if (NS_FAILED(rv))
aImage->CopyFrame(imgIContainer::FRAME_CURRENT,
imgIContainer::FLAG_NONE,
getter_AddRefs(frame));
if (!frame)
return nsnull;
return ImgSurfaceToPixbuf(frame, frame->Width(), frame->Height());
}