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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-12-06 11:16:52 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-12-06 11:16:52 +0300
commita60536956e69af3101b2bf29edb7a76fa4e74956 (patch)
tree1142cf29bdb0e6858c1a951c4e35388da6dc8d1d /intern/opencolorio
parentca2680aaeb122165adfb5ddd55d3ffc642c56a27 (diff)
Color management: Fix issue when active views/displays are not specified
Diffstat (limited to 'intern/opencolorio')
-rw-r--r--intern/opencolorio/ocio_impl.cc61
1 files changed, 33 insertions, 28 deletions
diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc
index 4e159fb9ab4..4a6645f57b3 100644
--- a/intern/opencolorio/ocio_impl.cc
+++ b/intern/opencolorio/ocio_impl.cc
@@ -213,21 +213,24 @@ const char *OCIOImpl::configGetDefaultDisplay(OCIO_ConstConfigRcPtr *config)
if (getenv("OCIO_ACTIVE_DISPLAYS") == NULL) {
const char *active_displays =
(*(ConstConfigRcPtr *) config)->getActiveDisplays();
- const char *separator_pos = strchr(active_displays, ',');
- if (separator_pos == NULL) {
- return active_displays;
- }
- static std::string active_display;
- /* NOTE: Configuration is shared and is never changed during runtime,
- * so we only guarantee two threads don't initialize at the same. */
- static std::mutex mutex;
- mutex.lock();
- if (active_display.empty()) {
- active_display = active_displays;
- active_display[separator_pos - active_displays] = '\0';
+ if (active_displays[0] != '\0') {
+ const char *separator_pos = strchr(active_displays, ',');
+ if (separator_pos == NULL) {
+ return active_displays;
+ }
+ static std::string active_display;
+ /* NOTE: Configuration is shared and is never changed during
+ * runtime, so we only guarantee two threads don't initialize at the
+ * same. */
+ static std::mutex mutex;
+ mutex.lock();
+ if (active_display.empty()) {
+ active_display = active_displays;
+ active_display[separator_pos - active_displays] = '\0';
+ }
+ mutex.unlock();
+ return active_display.c_str();
}
- mutex.unlock();
- return active_display.c_str();
}
#endif
@@ -273,21 +276,23 @@ const char *OCIOImpl::configGetDefaultView(OCIO_ConstConfigRcPtr *config, const
if (getenv("OCIO_ACTIVE_VIEWS") == NULL) {
const char *active_views =
(*(ConstConfigRcPtr *) config)->getActiveViews();
- const char *separator_pos = strchr(active_views, ',');
- if (separator_pos == NULL) {
- return active_views;
- }
- static std::string active_view;
- /* NOTE: Configuration is shared and is never changed during runtime,
- * so we only guarantee two threads don't initialize at the same. */
- static std::mutex mutex;
- mutex.lock();
- if (active_view.empty()) {
- active_view = active_views;
- active_view[separator_pos - active_views] = '\0';
+ if (active_views[0] != '\0') {
+ const char *separator_pos = strchr(active_views, ',');
+ if (separator_pos == NULL) {
+ return active_views;
+ }
+ static std::string active_view;
+ /* NOTE: Configuration is shared and is never changed during runtime,
+ * so we only guarantee two threads don't initialize at the same. */
+ static std::mutex mutex;
+ mutex.lock();
+ if (active_view.empty()) {
+ active_view = active_views;
+ active_view[separator_pos - active_views] = '\0';
+ }
+ mutex.unlock();
+ return active_view.c_str();
}
- mutex.unlock();
- return active_view.c_str();
}
#endif
try {