Commit: a60536956e69af3101b2bf29edb7a76fa4e74956
Author: Sergey Sharybin
Date:   Thu Dec 6 09:16:52 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBa60536956e69af3101b2bf29edb7a76fa4e74956

Color management: Fix issue when active views/displays are not specified

===================================================================

M       intern/opencolorio/ocio_impl.cc

===================================================================

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 {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to