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.
This commit is contained in:
Nathan Froyd 2015-03-11 13:19:43 -04:00
parent d7b5eebe96
commit 8bef8d02b7

View File

@ -192,11 +192,9 @@ nsImageBoxFrame::Init(nsIContent* aContent,
nsIFrame* aPrevInFlow)
{
if (!mListener) {
nsImageBoxListener *listener = new nsImageBoxListener();
NS_ADDREF(listener);
nsRefPtr<nsImageBoxListener> listener = new nsImageBoxListener();
listener->SetFrame(this);
listener->QueryInterface(NS_GET_IID(imgINotificationObserver), getter_AddRefs(mListener));
NS_RELEASE(listener);
mListener = listener.forget();
}
mSuppressStyleCheck = true;