Skip to content
Snippets Groups Projects
Commit 1ac050be authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1777553 - Use a weak pres context reference in nsMenuItemIconX....

Bug 1777553 - Use a weak pres context reference in nsMenuItemIconX. r=mac-reviewers,spohl, a=dmeehan

This is the only thing from the regressing patch that could potentially
cause this macOS leak, realistically. I don't think the leak is
super-worrisome, likely we just shut down the browser before the image
load finishes.

Differential Revision: https://phabricator.services.mozilla.com/D151368
parent 818c0289
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@
#import <Cocoa/Cocoa.h>
#include "mozilla/widget/IconLoader.h"
#include "mozilla/WeakPtr.h"
class nsIconLoaderService;
class nsIURI;
......@@ -62,7 +63,7 @@ class nsMenuItemIconX final : public mozilla::widget::IconLoader::Listener {
Listener* mListener; // [weak]
nsIntRect mImageRegionRect;
RefPtr<const mozilla::ComputedStyle> mComputedStyle;
RefPtr<nsPresContext> mPresContext;
mozilla::WeakPtr<nsPresContext> mPresContext;
NSImage* mIconImage = nil; // [strong]
RefPtr<mozilla::widget::IconLoader> mIconLoader;
};
......
......@@ -167,10 +167,10 @@ nsresult nsMenuItemIconX::OnComplete(imgIContainer* aImage) {
[mIconImage release];
mIconImage = nil;
}
RefPtr<nsPresContext> pc = mPresContext.get();
mIconImage = [[MOZIconHelper iconImageFromImageContainer:aImage
withSize:NSMakeSize(kIconSize, kIconSize)
presContext:mPresContext
presContext:pc
computedStyle:mComputedStyle
subrect:mImageRegionRect
scaleFactor:0.0f] retain];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment