workaround for crash when rig library links dont load. - will leak memory but better...
[blender.git] / source / blender / blenloader / intern / readfile.c
index 081264d62df11258de6d0969e5d5f816591bbc2a..71e440cd1b83f0701b7cf34a9f8db202b4124744 100644 (file)
@@ -4051,7 +4051,16 @@ static void lib_link_object(FileData *fd, Main *main)
                                warn = 1;
                                
                                if (ob->pose) {
+                                       /* we can't call #BKE_pose_free() here because of library linking
+                                        * freeing will recurse down into every pose constraints ID pointers
+                                        * which are not always valid, so for now free directly and suffer
+                                        * some leaked memory rather then crashing immediately
+                                        * while bad this _is_ an exceptional case - campbell */
+#if 0
                                        BKE_pose_free(ob->pose);
+#else
+                                       MEM_freeN(ob->pose);
+#endif
                                        ob->pose= NULL;
                                        ob->mode &= ~OB_MODE_POSE;
                                }