Merge pull request #6091 from electron/icon-progress-crash
Fix crash setting progress after setting dock icon
This commit is contained in:
commit
57ed682e34
2 changed files with 19 additions and 1 deletions
|
@ -926,7 +926,9 @@ void NativeWindowMac::SetProgressBar(double progress) {
|
|||
NSImageView* image_view = [[NSImageView alloc] init];
|
||||
[image_view setImage:[NSApp applicationIconImage]];
|
||||
[dock_tile setContentView:image_view];
|
||||
}
|
||||
|
||||
if ([[dock_tile.contentView subviews] count] == 0) {
|
||||
NSProgressIndicator* progress_indicator = [[AtomProgressBar alloc]
|
||||
initWithFrame:NSMakeRect(0.0f, 0.0f, dock_tile.size.width, 15.0)];
|
||||
[progress_indicator setStyle:NSProgressIndicatorBarStyle];
|
||||
|
@ -935,7 +937,7 @@ void NativeWindowMac::SetProgressBar(double progress) {
|
|||
[progress_indicator setMinValue:0];
|
||||
[progress_indicator setMaxValue:1];
|
||||
[progress_indicator setHidden:NO];
|
||||
[image_view addSubview:progress_indicator];
|
||||
[dock_tile.contentView addSubview:progress_indicator];
|
||||
}
|
||||
|
||||
NSProgressIndicator* progress_indicator =
|
||||
|
|
|
@ -337,6 +337,22 @@ describe('browser-window module', function () {
|
|||
})
|
||||
})
|
||||
|
||||
describe('BrowserWindow.setProgressBar(progress)', function () {
|
||||
it('sets the progress', function () {
|
||||
assert.doesNotThrow(function () {
|
||||
if (process.platform === 'darwin') {
|
||||
app.dock.setIcon(path.join(fixtures, 'assets', 'logo.png'))
|
||||
}
|
||||
w.setProgressBar(.5)
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
app.dock.setIcon(null)
|
||||
}
|
||||
w.setProgressBar(-1)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('BrowserWindow.fromId(id)', function () {
|
||||
it('returns the window with id', function () {
|
||||
assert.equal(w.id, BrowserWindow.fromId(w.id).id)
|
||||
|
|
Loading…
Add table
Reference in a new issue