Skip to content

Commit

Permalink
fix: do not leak memory when setting dockTile
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Jan 21, 2019
1 parent 9a96a46 commit 0fd7979
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions atom/browser/native_window_mac.mm
Expand Up @@ -1137,19 +1137,20 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
// For the first time API invoked, we need to create a ContentView in
// DockTile.
if (first_time) {
NSImageView* image_view = [[NSImageView alloc] init];
base::scoped_nsobject<NSImageView> image_view([[NSImageView alloc] init]);
[image_view setImage:[NSApp applicationIconImage]];
[dock_tile setContentView:image_view];
[dock_tile setContentView:image_view.autorelease()];

NSProgressIndicator* progress_indicator = [[AtomProgressBar alloc]
initWithFrame:NSMakeRect(0.0f, 0.0f, dock_tile.size.width, 15.0)];
base::scoped_nsobject<NSProgressIndicator> progress_indicator(
[[AtomProgressBar alloc]
initWithFrame:NSMakeRect(0.0f, 0.0f, dock_tile.size.width, 15.0)]);
[progress_indicator setStyle:NSProgressIndicatorBarStyle];
[progress_indicator setIndeterminate:NO];
[progress_indicator setBezeled:YES];
[progress_indicator setMinValue:0];
[progress_indicator setMaxValue:1];
[progress_indicator setHidden:NO];
[dock_tile.contentView addSubview:progress_indicator];
[dock_tile.contentView addSubview:progress_indicator.autorelease()];
}

NSProgressIndicator* progress_indicator = static_cast<NSProgressIndicator*>(
Expand Down

0 comments on commit 0fd7979

Please sign in to comment.