From 75f133285fbef7c42b09b7795646839260674e5b Mon Sep 17 00:00:00 2001 From: "Torrance, Douglas" Date: Tue, 29 Jun 2021 19:21:32 +0000 Subject: [PATCH] Fix segfault in color picker Previously, we released the color well's color even if it was the same as the new color. This eventually resulted in a segfault when calling WMPaintColorSwatch because we tried calling XFillRectangle with no display. We fix this by only releasing/updating the color well's if it differs from the new color. --- WINGs/wcolorwell.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WINGs/wcolorwell.c b/WINGs/wcolorwell.c index c67c7d0f..17187f83 100644 --- a/WINGs/wcolorwell.c +++ b/WINGs/wcolorwell.c @@ -173,10 +173,10 @@ WMColorWell *WMCreateColorWell(WMWidget * parent) void WMSetColorWellColor(WMColorWell * cPtr, WMColor * color) { - if (cPtr->color) + if (cPtr->color && cPtr->color != color) { WMReleaseColor(cPtr->color); - - cPtr->color = WMRetainColor(color); + cPtr->color = WMRetainColor(color); + } if (cPtr->colorView->flags.realized && cPtr->colorView->flags.mapped) paintColorWell(cPtr);