[Volume Control] Only initialize view once

Only initialize viewController once, the first time the volume control
is opened. Re-initializing it can cause an error assigning it as first
responder to the volume slider popover view.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-21 22:52:05 -07:00
parent aa36e3ce10
commit bb95270747
1 changed files with 5 additions and 3 deletions

View File

@ -38,9 +38,11 @@
- (void)mouseDown:(NSEvent *)theEvent { - (void)mouseDown:(NSEvent *)theEvent {
[popover close]; [popover close];
viewController = [[NSViewController alloc] init]; if(!viewController) {
viewController.view = _popView; viewController = [[NSViewController alloc] init];
popover.contentViewController = viewController; viewController.view = _popView;
popover.contentViewController = viewController;
}
[popover showRelativeToRect:self.bounds ofView:self preferredEdge:NSRectEdgeMaxY]; [popover showRelativeToRect:self.bounds ofView:self preferredEdge:NSRectEdgeMaxY];