xbar icon indicating copy to clipboard operation
xbar copied to clipboard

Segfaults on refresh

Open jobor019 opened this issue 3 years ago • 6 comments

Hi! Thanks for developing such an amazing app!

Running the 2.10-beta (brew installation) on MacOS 10.15.7, I've noticed quite a lot of crashes when interacting with clickable items. More specifically, it seems that these errors occur when a script refreshes while the menu of a plugin is open, i.e. when the following sequence occurs:

  1. A menu bar plugin is clicked to expand the menu
  2. A refresh occurs
  3. An item in the menu is clicked -> segfault

A minimal example from the readme to reproduce this error: (filename: test.1s.sh):

#!/usr/bin/env bash

echo 'test'
echo '---'
echo 'Open website | href=https://xbarapp.com'

This will crash almost every time Open website is clicked. Changing the filename to test.1m.sh will result in very few crashes in normal usage, but it's still possible to reproduce the error by clicking test, waiting 60 seconds, clicking Open website.

jobor019 avatar Jul 02 '21 21:07 jobor019

I haven't confirmed the same sequence of events (eg, plugin is doing a refresh), but I experience a crash nearly every time I click an xbar menu item. At least one of the plugins I use does a refresh after running a command, so I suspect it's the same issue. Problem started with 2.1.0-beta.

cngarrison avatar Jul 03 '21 04:07 cngarrison

Hi. Are you running on M1 by any chance? I've discovered that the code that detects when a menu is open doesn't work on M1, despite the same code working fine on Intel! We use this to ensure that the menus aren't "pulled from under your feet". Could you please try this:

  1. Right click xbar in finder
  2. Select "Get Info"
  3. Check "Open using Rosetta"
  4. Restart xbar

Thanks.

leaanthony avatar Jul 03 '21 06:07 leaanthony

I do not have an M1 mac. Sorry I couldn't help with a simple culprit.

cngarrison avatar Jul 03 '21 07:07 cngarrison

Same, I'm running this on a 2018 MBP13 (Catalina, as mentioned above), so I'm afraid this isn't the issue.

jobor019 avatar Jul 03 '21 07:07 jobor019

Yeah, sorry about that - this one's on me. Just done some debugging and it turns out my aggressive approach to memory leaks introduced a regression that is ultimately the cause of this. I've created a fix and Mat and I will be testing over the weekend. If all goes well, expect a release shortly.

leaanthony avatar Jul 03 '21 09:07 leaanthony

👍

Thanks for the update

cngarrison avatar Jul 03 '21 23:07 cngarrison