From 1068a33167fdda8892c437a95c6bcc0f3ef05183 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Tue, 14 Jun 2022 01:14:39 -0700 Subject: [PATCH] Mended Color Mixer random color bug If you set a color, then come back to Color Mixer and immediately dismiss the dialog (without setting a color), an indeterminate color could appear due to uninitialized variables (new_r, _g, _b). Closes https://sourceforge.net/p/tuxpaint/bugs/251/ h/t @kentonyanamin on Twitter --- docs/CHANGES.txt | 7 +++++++ src/tuxpaint.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index c60a073c4..aefbfaa9b 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -8,6 +8,13 @@ http://www.tuxpaint.org/ 2022.June.14 (0.9.29) + * Bug Fixes: + ---------- + * Opening and immediately dismissing Color Mixer could cause + an unexpected color to be chosen. + h/t @kentonyanamin on Twitter for reporting. + Closes https://sourceforge.net/p/tuxpaint/bugs/251/ + * Other Improvements: ------------------- * Automatic button size option ("buttonsize=auto"), to scale button diff --git a/src/tuxpaint.c b/src/tuxpaint.c index e42fe858f..0ce372eb1 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -23209,6 +23209,14 @@ static int do_color_mix(void) for (i = 0; i < NUM_MIXER_COLORS; i++) color_mixer_color_counts[i] = 0; } + else + { + new_r = color_hexes[COLOR_MIXER][0]; + new_g = color_hexes[COLOR_MIXER][1]; + new_b = color_hexes[COLOR_MIXER][2]; + } + + done = 0; chose = 0;