Infinite Recursion during Splash Screen

Hello,

I mistakenly updated to macOS Big Sur, which has given me some headaches when it comes to working on Audacity. Since then, I’ve moved to working on Windows 10 temporarily, but I thought I’d let you know of the bug that’s currently been hitting me. While a pre-built version of Audacity runs normally on macOS Big Sur, building it from scratch creates a version that doesn’t make it to the splash screen.

I’m getting a stack overflow caused by infinite recursion that occurs somewhere in the splash screen. It looks like it has to do with how the forked version of wxWidgets is being built. The error seems to actually be in the forked version of wxWidgets. I have been getting this both with latest commit on master (tested as of Nov 24) and stable release tag v2.4.2. Here are some screenshots showing the infinite recursion.

Here is the entry point within the Audacity Source code.

This is the entry point for the infinite recursion. This line looks to be the culprit, as I’ll get into later.

As you can see, the macro wxSMALL_FONT is defined as this:

Then lastly, to complete the circle, this method calls back to the entry point. Notice this method is first called with FONT_SMALL, which then recursively calls itself with FONT_NORMAL, which goes back to wxSystemSettings, the parent class of wxSystemSettingsNative, which calls wxFONT_SMALL, a macro defined to call this method with FONT_SMALL. You can see where this is going…

The interesting thing is that I think the wxWidgets developers found this bug themselves, but it was fixed at some point after the Audacity team forked from the project. Here’s what I found on GitHub.

Their most recent change on this file was 5 months ago with the commit message of “Avoid infinite recursion between wxStockGDI and wxSystemSettions” on July 10. Here’s the line in question, and it’s different from the one reflected in the Audacity forked version.

https://github.com/wxWidgets/wxWidgets/blob/cda21c8ddc3b96e2e7ec7955840bc2db34684d2d/src/osx/cocoa/settings.mm#L208

I tried rebasing on top of the wxWidgets release 3.1.4 tag, but wasn’t able to get wxWidgets to properly build. I will keep you updated on what I do, but I was wondering if there was someone who had a little more familiarity with the Audacity changes to wxWidgets who could take a look at this.

Thanks!

I think you’re right. Thank you for bringing this to our attention.

The fix in wxWidgets 3.1.4 is now cherry-picked onto Audacity’s custom build of 3.1.3 at https://github.com/audacity/wxWidgets.git

(and one other commit as well for a different bug)

Paul