Cycles:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 5 Dec 2011 19:54:59 +0000 (19:54 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 5 Dec 2011 19:54:59 +0000 (19:54 +0000)
Fix #29475: remove node from properties editor crash on windows. This was a bug
in the UI code, which code access removed data.
Fix OpenCL still being used in a case where Experimental was disabled.
Fix msvc debug warning in md5 code.

intern/cycles/blender/blender_sync.cpp
intern/cycles/util/util_md5.cpp
source/blender/editors/interface/interface_handlers.c

index f7b1ca53fd3bc302701101abbc30f96548541a09..b89b7ebb9be8ffa50344acbe799631d47399a270 100644 (file)
@@ -264,7 +264,12 @@ SessionParams BlenderSync::get_session_params(BL::Scene b_scene, bool background
 
        if(RNA_enum_get(&cscene, "device") != 0) {
                vector<DeviceType> types = Device::available_types();
-               DeviceType dtype = (RNA_enum_get(&cscene, "gpu_type") == 0)? DEVICE_CUDA: DEVICE_OPENCL;
+               DeviceType dtype;
+               
+               if(!experimental || RNA_enum_get(&cscene, "gpu_type") == 0)
+                       dtype = DEVICE_CUDA;
+               else
+                       dtype = DEVICE_CUDA;
 
                if(device_type_available(types, dtype))
                        params.device_type = dtype;
index b871fad363646f91650ae1bc68d748103830e145..25a77f18d0247ff77c508b0e6bc12656197910d0 100644 (file)
@@ -361,14 +361,15 @@ void MD5Hash::finish(uint8_t digest[16])
 string MD5Hash::get_hex()
 {
        uint8_t digest[16];
-       char buf[16*2];
+       char buf[16*2+1];
 
        finish(digest);
 
        for(int i=0; i<16; i++)
                sprintf(buf + i*2, "%02X", digest[i]);
+       buf[sizeof(buf)-1] = '\0';
        
-       return string(buf, sizeof(buf));
+       return string(buf);
 }
 
 CCL_NAMESPACE_END
index c24d07f73b99e31bcebca01915ee4d406419a7bd..c6159487145d0428ea03c9d0375c34b6e22fa7aa 100644 (file)
@@ -5241,9 +5241,10 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
 
        data->state= state;
 
-       if(state != BUTTON_STATE_EXIT) {
+       if(!ELEM(state, BUTTON_STATE_EXIT, BUTTON_STATE_HIGHLIGHT)) {
                /* When objects for eg. are removed, running ui_check_but()
-                * can access the removed data - so disable update on exit */
+                * can access the removed data - so disable update on exit
+                * or highlight */
                ui_check_but(but);
        }