From 4a0d4bb09331e9c935874d8a2085c658de86b5da Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 21 Jun 2022 22:52:05 -0700 Subject: [PATCH] [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 --- Window/VolumeButton.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Window/VolumeButton.m b/Window/VolumeButton.m index 809683047..b70903492 100644 --- a/Window/VolumeButton.m +++ b/Window/VolumeButton.m @@ -38,9 +38,11 @@ - (void)mouseDown:(NSEvent *)theEvent { [popover close]; - viewController = [[NSViewController alloc] init]; - viewController.view = _popView; - popover.contentViewController = viewController; + if(!viewController) { + viewController = [[NSViewController alloc] init]; + viewController.view = _popView; + popover.contentViewController = viewController; + } [popover showRelativeToRect:self.bounds ofView:self preferredEdge:NSRectEdgeMaxY];