Added upstream fix for threading issue with plugin registration (bug #912307).

Resolves: rhbz#912307
This commit is contained in:
Tim Waugh 2013-03-07 16:40:17 +00:00
parent c1f496c53f
commit c2b6be2ba4
2 changed files with 325 additions and 1 deletions

View File

@ -0,0 +1,318 @@
diff -up lcms2-2.4/include/lcms2.h.threading-plugin lcms2-2.4/include/lcms2.h
--- lcms2-2.4/include/lcms2.h.threading-plugin 2012-09-10 17:01:51.000000000 +0100
+++ lcms2-2.4/include/lcms2.h 2013-03-07 16:38:14.475481017 +0000
@@ -985,6 +985,7 @@ CMSAPI long int CMSEXPORT cmsfi
// Plug-In registering ---------------------------------------------------------------------------------------------------
CMSAPI cmsBool CMSEXPORT cmsPlugin(void* Plugin);
+CMSAPI cmsBool CMSEXPORT cmsPluginTHR(cmsContext ContextID, void* Plugin);
CMSAPI void CMSEXPORT cmsUnregisterPlugins(void);
// Error logging ----------------------------------------------------------------------------------------------------------
diff -up lcms2-2.4/src/cmscnvrt.c.threading-plugin lcms2-2.4/src/cmscnvrt.c
--- lcms2-2.4/src/cmscnvrt.c.threading-plugin 2012-09-10 17:01:51.000000000 +0100
+++ lcms2-2.4/src/cmscnvrt.c 2013-03-07 16:38:14.475481017 +0000
@@ -1028,7 +1028,7 @@ cmsUInt32Number CMSEXPORT cmsGetSupporte
}
// The plug-in registration. User can add new intents or override default routines
-cmsBool _cmsRegisterRenderingIntentPlugin(cmsPluginBase* Data)
+cmsBool _cmsRegisterRenderingIntentPlugin(cmsContext id, cmsPluginBase* Data)
{
cmsPluginRenderingIntent* Plugin = (cmsPluginRenderingIntent*) Data;
cmsIntentsList* fl;
@@ -1043,7 +1043,7 @@ cmsBool _cmsRegisterRenderingIntentPlug
fl = SearchIntent(Plugin ->Intent);
if (fl == NULL) {
- fl = (cmsIntentsList*) _cmsPluginMalloc(sizeof(cmsIntentsList));
+ fl = (cmsIntentsList*) _cmsPluginMalloc(id, sizeof(cmsIntentsList));
if (fl == NULL) return FALSE;
}
diff -up lcms2-2.4/src/cmsgamma.c.threading-plugin lcms2-2.4/src/cmsgamma.c
--- lcms2-2.4/src/cmsgamma.c.threading-plugin 2012-09-10 17:01:51.000000000 +0100
+++ lcms2-2.4/src/cmsgamma.c 2013-03-07 16:38:14.475481017 +0000
@@ -70,7 +70,7 @@ static _cmsParametricCurvesCollection De
static _cmsParametricCurvesCollection* ParametricCurves = &DefaultCurves;
// As a way to install new parametric curves
-cmsBool _cmsRegisterParametricCurvesPlugin(cmsPluginBase* Data)
+cmsBool _cmsRegisterParametricCurvesPlugin(cmsContext id, cmsPluginBase* Data)
{
cmsPluginParametricCurves* Plugin = (cmsPluginParametricCurves*) Data;
_cmsParametricCurvesCollection* fl;
@@ -81,7 +81,7 @@ cmsBool _cmsRegisterParametricCurvesPlug
return TRUE;
}
- fl = (_cmsParametricCurvesCollection*) _cmsPluginMalloc(sizeof(_cmsParametricCurvesCollection));
+ fl = (_cmsParametricCurvesCollection*) _cmsPluginMalloc(id, sizeof(_cmsParametricCurvesCollection));
if (fl == NULL) return FALSE;
// Copy the parameters
diff -up lcms2-2.4/src/cmsopt.c.threading-plugin lcms2-2.4/src/cmsopt.c
--- lcms2-2.4/src/cmsopt.c.threading-plugin 2012-09-10 17:01:51.000000000 +0100
+++ lcms2-2.4/src/cmsopt.c 2013-03-07 16:38:14.475481017 +0000
@@ -1609,7 +1609,7 @@ static _cmsOptimizationCollection Defaul
static _cmsOptimizationCollection* OptimizationCollection = DefaultOptimization;
// Register new ways to optimize
-cmsBool _cmsRegisterOptimizationPlugin(cmsPluginBase* Data)
+cmsBool _cmsRegisterOptimizationPlugin(cmsContext id, cmsPluginBase* Data)
{
cmsPluginOptimization* Plugin = (cmsPluginOptimization*) Data;
_cmsOptimizationCollection* fl;
@@ -1623,7 +1623,7 @@ cmsBool _cmsRegisterOptimizationPlugin(
// Optimizer callback is required
if (Plugin ->OptimizePtr == NULL) return FALSE;
- fl = (_cmsOptimizationCollection*) _cmsPluginMalloc(sizeof(_cmsOptimizationCollection));
+ fl = (_cmsOptimizationCollection*) _cmsPluginMalloc(id, sizeof(_cmsOptimizationCollection));
if (fl == NULL) return FALSE;
// Copy the parameters
diff -up lcms2-2.4/src/cmspack.c.threading-plugin lcms2-2.4/src/cmspack.c
--- lcms2-2.4/src/cmspack.c.threading-plugin 2012-09-10 17:01:51.000000000 +0100
+++ lcms2-2.4/src/cmspack.c 2013-03-07 16:38:14.477481025 +0000
@@ -3137,7 +3137,7 @@ static cmsFormattersFactoryList* Factory
// Formatters management
-cmsBool _cmsRegisterFormattersPlugin(cmsPluginBase* Data)
+cmsBool _cmsRegisterFormattersPlugin(cmsContext id, cmsPluginBase* Data)
{
cmsPluginFormatters* Plugin = (cmsPluginFormatters*) Data;
cmsFormattersFactoryList* fl ;
@@ -3149,7 +3149,7 @@ cmsBool _cmsRegisterFormattersPlugin(cm
return TRUE;
}
- fl = (cmsFormattersFactoryList*) _cmsPluginMalloc(sizeof(cmsFormattersFactoryList));
+ fl = (cmsFormattersFactoryList*) _cmsPluginMalloc(id, sizeof(cmsFormattersFactoryList));
if (fl == NULL) return FALSE;
fl ->Factory = Plugin ->FormattersFactory;
diff -up lcms2-2.4/src/cmsplugin.c.threading-plugin lcms2-2.4/src/cmsplugin.c
--- lcms2-2.4/src/cmsplugin.c.threading-plugin 2012-09-10 17:01:51.000000000 +0100
+++ lcms2-2.4/src/cmsplugin.c 2013-03-07 16:38:14.478481030 +0000
@@ -514,10 +514,10 @@ cmsBool CMSEXPORT _cmsIOPrintf(cmsIOHAND
static _cmsSubAllocator* PluginPool = NULL;
// Specialized malloc for plug-ins, that is freed upon exit.
-void* _cmsPluginMalloc(cmsUInt32Number size)
+void* _cmsPluginMalloc(cmsContext id, cmsUInt32Number size)
{
if (PluginPool == NULL)
- PluginPool = _cmsCreateSubAlloc(0, 4*1024);
+ PluginPool = _cmsCreateSubAlloc(id, 4*1024);
return _cmsSubAlloc(PluginPool, size);
}
@@ -526,6 +526,11 @@ void* _cmsPluginMalloc(cmsUInt32Number s
// Main plug-in dispatcher
cmsBool CMSEXPORT cmsPlugin(void* Plug_in)
{
+ return cmsPluginTHR(NULL, Plug_in);
+}
+
+cmsBool CMSEXPORT cmsPluginTHR(cmsContext id, void* Plug_in)
+{
cmsPluginBase* Plugin;
for (Plugin = (cmsPluginBase*) Plug_in;
@@ -554,35 +559,35 @@ cmsBool CMSEXPORT cmsPlugin(void* Plug_i
break;
case cmsPluginTagTypeSig:
- if (!_cmsRegisterTagTypePlugin(Plugin)) return FALSE;
+ if (!_cmsRegisterTagTypePlugin(id, Plugin)) return FALSE;
break;
case cmsPluginTagSig:
- if (!_cmsRegisterTagPlugin(Plugin)) return FALSE;
+ if (!_cmsRegisterTagPlugin(id, Plugin)) return FALSE;
break;
case cmsPluginFormattersSig:
- if (!_cmsRegisterFormattersPlugin(Plugin)) return FALSE;
+ if (!_cmsRegisterFormattersPlugin(id, Plugin)) return FALSE;
break;
case cmsPluginRenderingIntentSig:
- if (!_cmsRegisterRenderingIntentPlugin(Plugin)) return FALSE;
+ if (!_cmsRegisterRenderingIntentPlugin(id, Plugin)) return FALSE;
break;
case cmsPluginParametricCurveSig:
- if (!_cmsRegisterParametricCurvesPlugin(Plugin)) return FALSE;
+ if (!_cmsRegisterParametricCurvesPlugin(id, Plugin)) return FALSE;
break;
case cmsPluginMultiProcessElementSig:
- if (!_cmsRegisterMultiProcessElementPlugin(Plugin)) return FALSE;
+ if (!_cmsRegisterMultiProcessElementPlugin(id, Plugin)) return FALSE;
break;
case cmsPluginOptimizationSig:
- if (!_cmsRegisterOptimizationPlugin(Plugin)) return FALSE;
+ if (!_cmsRegisterOptimizationPlugin(id, Plugin)) return FALSE;
break;
case cmsPluginTransformSig:
- if (!_cmsRegisterTransformPlugin(Plugin)) return FALSE;
+ if (!_cmsRegisterTransformPlugin(id, Plugin)) return FALSE;
break;
default:
@@ -601,14 +606,14 @@ void CMSEXPORT cmsUnregisterPlugins(void
{
_cmsRegisterMemHandlerPlugin(NULL);
_cmsRegisterInterpPlugin(NULL);
- _cmsRegisterTagTypePlugin(NULL);
- _cmsRegisterTagPlugin(NULL);
- _cmsRegisterFormattersPlugin(NULL);
- _cmsRegisterRenderingIntentPlugin(NULL);
- _cmsRegisterParametricCurvesPlugin(NULL);
- _cmsRegisterMultiProcessElementPlugin(NULL);
- _cmsRegisterOptimizationPlugin(NULL);
- _cmsRegisterTransformPlugin(NULL);
+ _cmsRegisterTagTypePlugin(NULL, NULL);
+ _cmsRegisterTagPlugin(NULL, NULL);
+ _cmsRegisterFormattersPlugin(NULL, NULL);
+ _cmsRegisterRenderingIntentPlugin(NULL, NULL);
+ _cmsRegisterParametricCurvesPlugin(NULL, NULL);
+ _cmsRegisterMultiProcessElementPlugin(NULL, NULL);
+ _cmsRegisterOptimizationPlugin(NULL, NULL);
+ _cmsRegisterTransformPlugin(NULL, NULL);
if (PluginPool != NULL)
_cmsSubAllocDestroy(PluginPool);
diff -up lcms2-2.4/src/cmstypes.c.threading-plugin lcms2-2.4/src/cmstypes.c
--- lcms2-2.4/src/cmstypes.c.threading-plugin 2012-09-10 17:01:51.000000000 +0100
+++ lcms2-2.4/src/cmstypes.c 2013-03-07 16:38:14.481481041 +0000
@@ -62,7 +62,7 @@ typedef struct _cmsTagTypeLinkedList_st
// Register a new type handler. This routine is shared between normal types and MPE
static
-cmsBool RegisterTypesPlugin(cmsPluginBase* Data, _cmsTagTypeLinkedList* LinkedList, cmsUInt32Number DefaultListCount)
+cmsBool RegisterTypesPlugin(cmsContext id, cmsPluginBase* Data, _cmsTagTypeLinkedList* LinkedList, cmsUInt32Number DefaultListCount)
{
cmsPluginTagType* Plugin = (cmsPluginTagType*) Data;
_cmsTagTypeLinkedList *pt, *Anterior = NULL;
@@ -89,7 +89,7 @@ cmsBool RegisterTypesPlugin(cmsPluginBas
}
// Registering happens in plug-in memory pool
- pt = (_cmsTagTypeLinkedList*) _cmsPluginMalloc(sizeof(_cmsTagTypeLinkedList));
+ pt = (_cmsTagTypeLinkedList*) _cmsPluginMalloc(id, sizeof(_cmsTagTypeLinkedList));
if (pt == NULL) return FALSE;
pt ->Handler = Plugin ->Handler;
@@ -5248,14 +5248,14 @@ static _cmsTagTypeLinkedList SupportedTa
#define DEFAULT_TAG_TYPE_COUNT (sizeof(SupportedTagTypes) / sizeof(_cmsTagTypeLinkedList))
// Both kind of plug-ins share same structure
-cmsBool _cmsRegisterTagTypePlugin(cmsPluginBase* Data)
+cmsBool _cmsRegisterTagTypePlugin(cmsContext id, cmsPluginBase* Data)
{
- return RegisterTypesPlugin(Data, SupportedTagTypes, DEFAULT_TAG_TYPE_COUNT);
+ return RegisterTypesPlugin(id, Data, SupportedTagTypes, DEFAULT_TAG_TYPE_COUNT);
}
-cmsBool _cmsRegisterMultiProcessElementPlugin(cmsPluginBase* Data)
+cmsBool _cmsRegisterMultiProcessElementPlugin(cmsContext id, cmsPluginBase* Data)
{
- return RegisterTypesPlugin(Data, SupportedMPEtypes, DEFAULT_MPE_TYPE_COUNT);
+ return RegisterTypesPlugin(id, Data, SupportedMPEtypes, DEFAULT_MPE_TYPE_COUNT);
}
@@ -5377,7 +5377,7 @@ static _cmsTagLinkedList SupportedTags[]
#define DEFAULT_TAG_COUNT (sizeof(SupportedTags) / sizeof(_cmsTagLinkedList))
-cmsBool _cmsRegisterTagPlugin(cmsPluginBase* Data)
+cmsBool _cmsRegisterTagPlugin(cmsContext id, cmsPluginBase* Data)
{
cmsPluginTag* Plugin = (cmsPluginTag*) Data;
_cmsTagLinkedList *pt, *Anterior;
@@ -5401,7 +5401,7 @@ cmsBool _cmsRegisterTagPlugin(cmsPlugin
pt = pt ->Next;
}
- pt = (_cmsTagLinkedList*) _cmsPluginMalloc(sizeof(_cmsTagLinkedList));
+ pt = (_cmsTagLinkedList*) _cmsPluginMalloc(id, sizeof(_cmsTagLinkedList));
if (pt == NULL) return FALSE;
pt ->Signature = Plugin ->Signature;
diff -up lcms2-2.4/src/cmsxform.c.threading-plugin lcms2-2.4/src/cmsxform.c
--- lcms2-2.4/src/cmsxform.c.threading-plugin 2012-09-10 17:01:51.000000000 +0100
+++ lcms2-2.4/src/cmsxform.c 2013-03-07 16:38:14.482481045 +0000
@@ -367,7 +367,7 @@ typedef struct _cmsTransformCollection_s
static _cmsTransformCollection* TransformCollection = NULL;
// Register new ways to transform
-cmsBool _cmsRegisterTransformPlugin(cmsPluginBase* Data)
+cmsBool _cmsRegisterTransformPlugin(cmsContext id, cmsPluginBase* Data)
{
cmsPluginTransform* Plugin = (cmsPluginTransform*) Data;
_cmsTransformCollection* fl;
@@ -383,7 +383,7 @@ cmsBool _cmsRegisterTransformPlugin(cms
if (Plugin ->Factory == NULL) return FALSE;
- fl = (_cmsTransformCollection*) _cmsPluginMalloc(sizeof(_cmsTransformCollection));
+ fl = (_cmsTransformCollection*) _cmsPluginMalloc(id, sizeof(_cmsTransformCollection));
if (fl == NULL) return FALSE;
// Copy the parameters
diff -up lcms2-2.4/src/lcms2_internal.h.threading-plugin lcms2-2.4/src/lcms2_internal.h
--- lcms2-2.4/src/lcms2_internal.h.threading-plugin 2012-09-10 17:01:51.000000000 +0100
+++ lcms2-2.4/src/lcms2_internal.h 2013-03-07 16:38:14.483481050 +0000
@@ -167,7 +167,7 @@ cmsINLINE cmsUInt16Number _cmsQuickSatur
// Plug-In registering ---------------------------------------------------------------
// Specialized function for plug-in memory management. No pairing free() since whole pool is freed at once.
-void* _cmsPluginMalloc(cmsUInt32Number size);
+void* _cmsPluginMalloc(cmsContext ContextID, cmsUInt32Number size);
// Memory management
cmsBool _cmsRegisterMemHandlerPlugin(cmsPluginBase* Plugin);
@@ -176,28 +176,28 @@ cmsBool _cmsRegisterMemHandlerPlugin(c
cmsBool _cmsRegisterInterpPlugin(cmsPluginBase* Plugin);
// Parametric curves
-cmsBool _cmsRegisterParametricCurvesPlugin(cmsPluginBase* Plugin);
+cmsBool _cmsRegisterParametricCurvesPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
// Formatters management
-cmsBool _cmsRegisterFormattersPlugin(cmsPluginBase* Plugin);
+cmsBool _cmsRegisterFormattersPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
// Tag type management
-cmsBool _cmsRegisterTagTypePlugin(cmsPluginBase* Plugin);
+cmsBool _cmsRegisterTagTypePlugin(cmsContext ContextID, cmsPluginBase* Plugin);
// Tag management
-cmsBool _cmsRegisterTagPlugin(cmsPluginBase* Plugin);
+cmsBool _cmsRegisterTagPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
// Intent management
-cmsBool _cmsRegisterRenderingIntentPlugin(cmsPluginBase* Plugin);
+cmsBool _cmsRegisterRenderingIntentPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
// Multi Process elements
-cmsBool _cmsRegisterMultiProcessElementPlugin(cmsPluginBase* Plugin);
+cmsBool _cmsRegisterMultiProcessElementPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
// Optimization
-cmsBool _cmsRegisterOptimizationPlugin(cmsPluginBase* Plugin);
+cmsBool _cmsRegisterOptimizationPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
// Transform
-cmsBool _cmsRegisterTransformPlugin(cmsPluginBase* Plugin);
+cmsBool _cmsRegisterTransformPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
// ---------------------------------------------------------------------------------------------------------

View File

@ -1,10 +1,11 @@
Name: lcms2
Version: 2.4
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Color Management Engine
License: MIT
URL: http://www.littlecms.com/
Source0: http://www.littlecms.com/lcms2-2.4.tar.gz
Patch1: lcms2-threading-plugin.patch
BuildRequires: libjpeg-devel
BuildRequires: libtiff-devel
@ -33,6 +34,7 @@ Development files for LittleCMS.
%prep
%setup -q
%patch1 -p1 -b .threading-plugin
%build
%configure --disable-static --program-suffix=2
@ -80,6 +82,10 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Thu Mar 7 2013 Tim Waugh <twaugh@redhat.com> - 2.4-5
- Added upstream fix for threading issue with plugin registration
(bug #912307).
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild