Skip to content

Commit

Permalink
use deep copy to avoid
Browse files Browse the repository at this point in the history
circular pointer reference
  • Loading branch information
logica0419 committed Dec 11, 2023
1 parent fa38f02 commit 53cc3d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion service/imaging/processor_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ func (p *defaultProcessor) FitAnimationGIF(src io.Reader, width, height int) (*b

// Disposalが1に設定されていたら、Disposeされていないフレームを更新
if srcImage.Disposal[i] == gif.DisposalNone {
unDisposedFrame = tempCanvas
unDisposedFrame = &image.NRGBA{
Pix: append([]uint8{}, tempCanvas.Pix...),
Stride: tempCanvas.Stride,
Rect: tempCanvas.Rect,
} // tempCanvasはポインタを使い回しているので、Deep Copyする
}

// 拡縮用GoRoutineを起動
Expand Down

0 comments on commit 53cc3d9

Please sign in to comment.