Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-09-18 23:20:26 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-09-18 23:20:26 +0400
commit22fdc63b862533e5d7dc1e8b5e3b4f6056668363 (patch)
tree25a01a2a843ab840aefbfad9036f407f9c565d62 /intern/opencolorio
parent56175d8c802bbe4b31b2d75bc04f39936bf0899c (diff)
Color management: fix crashes and memory leaks when using custom OCIO configuration
Also fix some missing color spaces when loading some OCIO configurations, by falling back to scene linear if role is not found. There can still be some errors in the console, need to check this further. http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management#OpenColorIO_Configuration
Diffstat (limited to 'intern/opencolorio')
-rw-r--r--intern/opencolorio/ocio_capi.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/intern/opencolorio/ocio_capi.cpp b/intern/opencolorio/ocio_capi.cpp
index d67cea61836..2fa66e5d2f5 100644
--- a/intern/opencolorio/ocio_capi.cpp
+++ b/intern/opencolorio/ocio_capi.cpp
@@ -47,13 +47,13 @@
#endif
#define MEM_NEW(type) new(MEM_mallocN(sizeof(type), __func__)) type()
-#define MEM_DELETE(what, type) { what->~type(); MEM_freeN(what); } (void)0
+#define MEM_DELETE(what, type) if(what) { what->~type(); MEM_freeN(what); } (void)0
static void OCIO_reportError(const char *err)
{
std::cerr << "OpenColorIO Error: " << err << std::endl;
- OCIO_abort();
+ // OCIO_abort();
}
static void OCIO_reportException(Exception &exception)
@@ -75,6 +75,8 @@ ConstConfigRcPtr *OCIO_getCurrentConfig(void)
OCIO_reportException(exception);
}
+ MEM_DELETE(config, ConstConfigRcPtr);
+
return NULL;
}
@@ -107,6 +109,8 @@ ConstConfigRcPtr *OCIO_configCreateFromEnv(void)
OCIO_reportException(exception);
}
+ MEM_DELETE(config, ConstConfigRcPtr);
+
return NULL;
}
@@ -125,6 +129,8 @@ ConstConfigRcPtr *OCIO_configCreateFromFile(const char *filename)
OCIO_reportException(exception);
}
+ MEM_DELETE(config, ConstConfigRcPtr);
+
return NULL;
}
@@ -169,9 +175,10 @@ ConstColorSpaceRcPtr *OCIO_configGetColorSpace(ConstConfigRcPtr *config, const c
}
catch (Exception &exception) {
OCIO_reportException(exception);
- MEM_DELETE(cs, ConstColorSpaceRcPtr);
}
+ MEM_DELETE(cs, ConstColorSpaceRcPtr);
+
return NULL;
}
@@ -314,6 +321,8 @@ ConstProcessorRcPtr *OCIO_configGetProcessorWithNames(ConstConfigRcPtr *config,
OCIO_reportException(exception);
}
+ MEM_DELETE(p, ConstProcessorRcPtr);
+
return 0;
}
@@ -331,6 +340,8 @@ ConstProcessorRcPtr *OCIO_configGetProcessor(ConstConfigRcPtr *config, ConstTran
OCIO_reportException(exception);
}
+ MEM_DELETE(p, ConstProcessorRcPtr);
+
return NULL;
}