Bug fix. add lock for GraphicsMagick function 08/309108/3 accepted/tizen/8.0/unified/20240408.152505
authorJiyong <jiyong.min@samsung.com>
Thu, 4 Apr 2024 23:27:12 +0000 (08:27 +0900)
committerJiyong <jiyong.min@samsung.com>
Fri, 5 Apr 2024 01:32:42 +0000 (10:32 +0900)
  - DF240401-00513

[Cause]
  The crach occurs during destroying semaphore lock when
  multi-threads are processed(decoding).
  In GraphicsMagick, InitialMagick() & DestroyMagick() functions
  are not thread-safe.

[Solution]
  So locker is added for GraphicsMagick.

Change-Id: Ia19a89dd32994aec5cda5bcdd13acbbf449da947

magick/mm_util_magick.c
packaging/libmm-utility.spec

index b329105..581dd00 100644 (file)
@@ -28,6 +28,7 @@
 #include "mm_util_private.h"
 #include "mm_util_magick.h"
 
+static GMutex gm_lock;
 
 static bool __mm_util_check_rotation(mm_util_rotate_type_e rotation);
 static void __mm_util_magick_fatal_error_handler(const ExceptionType excep, const char *reason, const char *message) MAGICK_FUNC_NORETURN;
@@ -69,6 +70,8 @@ static void __mm_util_magick_fatal_error_handler(const ExceptionType excep, cons
 
 static void __mm_util_init(ExceptionInfo *exception)
 {
+       g_mutex_lock(&gm_lock);
+
        InitializeMagick(NULL);
        if (exception != NULL)
                GetExceptionInfo(exception);
@@ -100,6 +103,8 @@ static void __mm_util_finalize(Image *image_1, Image *image_2, ExceptionInfo *ex
                DestroyExceptionInfo(exception);
 
        DestroyMagick();
+
+       g_mutex_unlock(&gm_lock);
 }
 
 static const char * __mm_util_get_map(mm_util_color_format_e format)
index acde0cb..0e7c3cb 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.4.16
+Version:    0.4.17
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0