From 8bef8d02b704d589b6298b13dc662e0ec3d8f324 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 11 Mar 2015 13:19:43 -0400 Subject: [PATCH] Bug 1150049 - tidy up nsImageBoxFrame::Init a little bit; r=dholbert We don't need to use manual NS_{ADDREF,RELEASE} here when nsRefPtr will do that for us. The manual QueryInterface invocation only serves to do an expensive static_cast and increase the refcount; we can forget our reference into mListener to achieve the same effect. --- layout/xul/nsImageBoxFrame.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/layout/xul/nsImageBoxFrame.cpp b/layout/xul/nsImageBoxFrame.cpp index f96c158db95e..feadce5b2a15 100644 --- a/layout/xul/nsImageBoxFrame.cpp +++ b/layout/xul/nsImageBoxFrame.cpp @@ -192,11 +192,9 @@ nsImageBoxFrame::Init(nsIContent* aContent, nsIFrame* aPrevInFlow) { if (!mListener) { - nsImageBoxListener *listener = new nsImageBoxListener(); - NS_ADDREF(listener); + nsRefPtr listener = new nsImageBoxListener(); listener->SetFrame(this); - listener->QueryInterface(NS_GET_IID(imgINotificationObserver), getter_AddRefs(mListener)); - NS_RELEASE(listener); + mListener = listener.forget(); } mSuppressStyleCheck = true;