Curve Control 1.0.1 is out now for Windows, macOS, and Linux. If you already own it, grab the update from the same download link in your original purchase email or your account portal, same license key, no new purchase needed.
What’s Fixed
Our first bug! A crash that could occur when closing the plugin window.
For the Curious
The crash had a genuinely interesting root cause, so we’ll walk through it for anyone who likes this stuff.
Curve Control’s slope buttons (the four buttons that pick 6, 12, 18, or 24 dB/octave on the high-pass and low-pass filters) each get their own visual style, pulled from a small lookup array built when the plugin’s editor window is constructed:
static LookAndFeel* slopeLAFs[4] = { laf6, laf12, laf18, laf24 };
That single word, static, was the entire bug. A static local variable in C++ is only initialized once; the first time that line of code runs in the process’s lifetime. Every time after that, the line is skipped and the array keeps whatever it already held.
laf6, laf12, laf18, and laf24 are pointers to objects owned by the editor itself. Close the plugin window, and the editor, along with everything it owns, including those four objects, gets destroyed. Reopen the window, and a brand new editor is constructed. The array is supposed to be rebuilt pointing at the new editor’s objects. Because it’s static, it wasn’t, it was still pointing at memory that had already been freed. The very next line that used those pointers was reading from freed memory, and the crash followed almost immediately.
The fix was one word: remove static. 😀 Now the array is rebuilt fresh every time the editor is constructed, exactly as intended.
Thanks to the customer who reported this one with enough detail to reproduce it reliably; that made this a same-day fix instead of a much longer hunt.