ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
[blender.git] / source / blender / blenkernel / intern / text.c
index 6def9e3e5035be593526897d52ff4bd7bc8c270f..594f9dffbee440c9a922c7f83b35d657fa10d6cf 100644 (file)
@@ -171,14 +171,17 @@ void BKE_text_free_lines(Text *text)
        text->curl = text->sell = NULL;
 }
 
+/** Free (or release) any data used by this text (does not free the text itself). */
 void BKE_text_free(Text *text)
 {
+       /* No animdata here. */
+
        BKE_text_free_lines(text);
 
-       if (text->name) MEM_freeN(text->name);
-       MEM_freeN(text->undo_buf);
+       MEM_SAFE_FREE(text->name);
+       MEM_SAFE_FREE(text->undo_buf);
 #ifdef WITH_PYTHON
-       if (text->compiled) BPY_text_free_code(text);
+       BPY_text_free_code(text);
 #endif
 }