Fix potentially dnagerous code in doversionning of brush.
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 15 Jun 2017 10:38:55 +0000 (12:38 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 15 Jun 2017 10:38:55 +0000 (12:38 +0200)
Even though in that specific it was probably safe-ish, there is no
guarantee at this point Brush we want to remove are not used somewhere,
better take the slightly slower, much safer `BKE_libblock_delete()` path here.

source/blender/blenloader/intern/versioning_defaults.c

index e34f12b1cf9808c17ba98c87c50c08536bacd66a..e7e0054e7a12646ef166d45b17de38a41d535ccd 100644 (file)
@@ -242,13 +242,13 @@ void BLO_update_defaults_startup_blend(Main *bmain)
                /* remove polish brush (flatten/contrast does the same) */
                br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Polish");
                if (br) {
-                       BKE_libblock_free(bmain, br);
+                       BKE_libblock_delete(bmain, br);
                }
 
                /* remove brush brush (huh?) from some modes (draw brushes do the same) */
                br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Brush");
                if (br) {
-                       BKE_libblock_free(bmain, br);
+                       BKE_libblock_delete(bmain, br);
                }
 
                /* remove draw brush from texpaint (draw brushes do the same) */