From: David Steele Date: Thu, 28 Sep 2017 19:22:43 +0000 (+0100) Subject: Ensured that style array is cleared when Builder parse tree is reloaded X-Git-Tag: dali_1.2.60~16^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=ced87ad561e5fd73b23c8abaa397b206448a2b4b Ensured that style array is cleared when Builder parse tree is reloaded If another JSON file is merged into an existing builder instance, it doesn't clear down the styles array, which means that changes to existing styles aren't picked up if they have already been parsed. (In normal use, style sheet is merged before controls are read; or a new application style sheet clears the existing builder instance). Change-Id: If5320925e3ca6d7b1587e0c359c05e915ca47390 Signed-off-by: David Steele --- diff --git a/dali-toolkit/internal/builder/builder-impl.cpp b/dali-toolkit/internal/builder/builder-impl.cpp index 4a23ed1..5a18bef 100644 --- a/dali-toolkit/internal/builder/builder-impl.cpp +++ b/dali-toolkit/internal/builder/builder-impl.cpp @@ -202,7 +202,12 @@ void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::U } } - if( !mParser.Parse( data ) ) + if( mParser.Parse( data ) ) + { + // Drop the styles and get them to be rebuilt against the new parse tree as required. + mStyles.Clear(); + } + else { DALI_LOG_WARNING( "JSON Parse Error:%d:%d:'%s'\n", mParser.GetErrorLineNumber(), @@ -213,8 +218,8 @@ void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::U } } - DUMP_PARSE_TREE(parser); // This macro only writes out if DEBUG is enabled and the "DUMP_TREE" constant is defined in the stylesheet. - DUMP_TEST_MAPPINGS(parser); + DUMP_PARSE_TREE(mParser); // This macro only writes out if DEBUG is enabled and the "DUMP_TREE" constant is defined in the stylesheet. + DUMP_TEST_MAPPINGS(mParser); DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Cannot parse JSON"); }