svg_loader: removing setting the locale 91/317291/1 accepted/tizen_8.0_unified tizen_8.0 accepted/tizen/8.0/unified/20250107.161524
authorjoogab.yun <joogab.yun@samsung.com>
Mon, 30 Dec 2024 05:43:18 +0000 (14:43 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Mon, 30 Dec 2024 05:51:21 +0000 (14:51 +0900)
The locale was set while reading the path attr,
which could have caused race conditions between
threads and potentially led to crashes.
Now removed as unnecessary.

https://github.com/thorvg/thorvg/pull/1390

Change-Id: Ieb88bbffaffdf5c1613fe663c328f6964b369725

src/loaders/svg/tvgSvgPath.cpp

index 6195807aff884dea16abdf06c23e6e7c77e9b7b6..e044931b5183d0bb0dfc37400d4a2a1c5ba987f6 100644 (file)
@@ -52,7 +52,6 @@
 
 #include <cstring>
 #include <math.h>
-#include <clocale>
 #include <ctype.h>
 #include "tvgSvgLoaderCommon.h"
 #include "tvgSvgPath.h"
@@ -545,11 +544,6 @@ bool svgPathToTvgPath(const char* svgPath, Array<PathCommand>& cmds, Array<Point
     char cmd = 0;
     bool isQuadratic = false;
     char* path = (char*)svgPath;
-    char* curLocale;
-
-    curLocale = setlocale(LC_NUMERIC, NULL);
-    if (curLocale) curLocale = strdup(curLocale);
-    setlocale(LC_NUMERIC, "POSIX");
 
     while ((path[0] != '\0')) {
         path = _nextCommand(path, &cmd, numberArray, &numberCount);
@@ -557,8 +551,5 @@ bool svgPathToTvgPath(const char* svgPath, Array<PathCommand>& cmds, Array<Point
         if (!_processCommand(&cmds, &pts, cmd, numberArray, numberCount, &cur, &curCtl, &startPoint, &isQuadratic)) break;
     }
 
-    setlocale(LC_NUMERIC, curLocale);
-    if (curLocale) free(curLocale);
-
     return true;
 }