From cd4bd98304dbfba38b3e089f406b59f218d6ec4a Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Thu, 3 Nov 2022 01:55:34 -0700 Subject: [PATCH] Fix opening a tab crashing MacVim This seems to be a really old bug but new interactions with macOS (probably due to macOS 13 Ventura) caused it to surface and crash. Previously it was assuming a call to removeTrackingRect must always come only after addTrackingRect was called, which was not a good assumption to make. As a result, we could call this and end up triggering other code in macOS when passing in a 0 tracking tag. Fix #1333 --- src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m b/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m index 10fed285a0..619ad077e8 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m +++ b/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m @@ -52,7 +52,9 @@ - (void)addTrackingRect - (void)removeTrackingRect { - [self removeTrackingRect:_myTrackingRectTag]; + if (_myTrackingRectTag != 0) + [self removeTrackingRect:_myTrackingRectTag]; + _myTrackingRectTag = 0; } // override for rollover effect