From 0749ba9357d9b89d3abf10cc845d422a6888e64f Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Tue, 16 Aug 2016 11:05:08 +0200 Subject: [PATCH] Bug 1289098 - Fixes to avoid Valgrind false positives with gcc-5.4 -O2 builds. r=dbaron. --HG-- extra : rebase_source : 489e0686b650f329c41bc5d2c2504ac308b9541d --- layout/style/nsStyleContext.cpp | 5 ++++- layout/style/nsStyleStruct.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index 626cef0d47ce..b6cf5aaa3e2c 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -1148,7 +1148,10 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext, const nsStyleOutline *thisVisOutline = thisVis->StyleOutline(); const nsStyleOutline *otherVisOutline = otherVis->StyleOutline(); bool haveColor; - nscolor thisColor, otherColor; + // Dummy initialisations to keep Valgrind/Memcheck happy. + // See bug 1289098 comment 1. + nscolor thisColor = NS_RGBA(0, 0, 0, 0); + nscolor otherColor = NS_RGBA(0, 0, 0, 0); if (thisVisOutline->GetOutlineInitialColor() != otherVisOutline->GetOutlineInitialColor() || (haveColor = thisVisOutline->GetOutlineColor(thisColor)) != diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index b699c7729ddd..0f742845b7d8 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -3698,7 +3698,10 @@ nsStyleTextReset::CalcDifference(const nsStyleTextReset& aNewData) const } // Repaint for decoration color changes - nscolor decColor, otherDecColor; + // Dummy initialisations to keep Valgrind/Memcheck happy. + // See bug 1289098 comment 1. + nscolor decColor = NS_RGBA(0, 0, 0, 0); + nscolor otherDecColor = NS_RGBA(0, 0, 0, 0); bool isFG, otherIsFG; GetDecorationColor(decColor, isFG); aNewData.GetDecorationColor(otherDecColor, otherIsFG);