diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 6d3157a7403e..53f4a9f568d4 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -214,7 +214,7 @@ nsImageFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroy imageLoader->RemoveNativeObserver(mListener); } - reinterpret_cast(mListener.get())->SetFrame(nullptr); + mListener->SetFrame(nullptr); } mListener = nullptr; diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index 233cd7c1ceaa..c42a10da20db 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -331,7 +331,7 @@ private: RefPtr mImageMap; - nsCOMPtr mListener; + RefPtr mListener; nsCOMPtr mImage; nsCOMPtr mPrevImage;