diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-24 20:20:43 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-24 20:20:43 +0400 |
commit | 623f3b3e3a69625add367b670108ed6477443d92 (patch) | |
tree | 3a3a0733ecf97393987e83955350ba3c0e691d53 /source/blender/makesrna | |
parent | b12a0199480f5d452828450fa257020635f7ad6d (diff) |
Fix/workaround for cycles crash when enabling it for preview renders.
Problem is that preview render database is being used, but the new datablock
function still uses G.main, and the mesh was being added to one database but
(attempted to be) removed from another. The proper fix would get rid of the
globals here, will look into that later.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index cc74fce1733..e9ed3aa8682 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -105,11 +105,11 @@ static Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name) id_us_min(id); return (Camera *)id; } -static void rna_Main_cameras_remove(Main *bmain, ReportList *reports, PointerRNA *camera_ptr) +static void rna_Main_cameras_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *camera_ptr) { Camera *camera = camera_ptr->data; if (ID_REAL_USERS(camera) <= 0) { - BKE_libblock_free(&bmain->camera, camera); + BKE_libblock_free(&G.main->camera, camera); RNA_POINTER_INVALIDATE(camera_ptr); } else { @@ -198,12 +198,12 @@ static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, co return ob; } -static void rna_Main_objects_remove(Main *bmain, ReportList *reports, PointerRNA *object_ptr) +static void rna_Main_objects_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *object_ptr) { Object *object = object_ptr->data; if (ID_REAL_USERS(object) <= 0) { BKE_object_unlink(object); /* needed or ID pointers to this are not cleared */ - BKE_libblock_free(&bmain->object, object); + BKE_libblock_free(&G.main->object, object); RNA_POINTER_INVALIDATE(object_ptr); } else { @@ -218,11 +218,11 @@ static Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name) id_us_min(id); return (Material *)id; } -static void rna_Main_materials_remove(Main *bmain, ReportList *reports, PointerRNA *material_ptr) +static void rna_Main_materials_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *material_ptr) { Material *material = material_ptr->data; if (ID_REAL_USERS(material) <= 0) { - BKE_libblock_free(&bmain->mat, material); + BKE_libblock_free(&G.main->mat, material); RNA_POINTER_INVALIDATE(material_ptr); } else { @@ -238,11 +238,11 @@ static bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, i id_us_min(&tree->id); return tree; } -static void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, PointerRNA *tree_ptr) +static void rna_Main_nodetree_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *tree_ptr) { bNodeTree *tree = tree_ptr->data; if (ID_REAL_USERS(tree) <= 0) { - BKE_libblock_free(&bmain->nodetree, tree); + BKE_libblock_free(&G.main->nodetree, tree); RNA_POINTER_INVALIDATE(tree_ptr); } else { @@ -257,11 +257,12 @@ static Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name) id_us_min(&me->id); return me; } -static void rna_Main_meshes_remove(Main *bmain, ReportList *reports, PointerRNA *mesh_ptr) +static void rna_Main_meshes_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *mesh_ptr) { Mesh *mesh = mesh_ptr->data; + if (ID_REAL_USERS(mesh) <= 0) { - BKE_libblock_free(&bmain->mesh, mesh); + BKE_libblock_free(&G.main->mesh, mesh); RNA_POINTER_INVALIDATE(mesh_ptr); } else { @@ -277,11 +278,11 @@ static Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type) id_us_min(&lamp->id); return lamp; } -static void rna_Main_lamps_remove(Main *bmain, ReportList *reports, PointerRNA *lamp_ptr) +static void rna_Main_lamps_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *lamp_ptr) { Lamp *lamp = lamp_ptr->data; if (ID_REAL_USERS(lamp) <= 0) { - BKE_libblock_free(&bmain->lamp, lamp); + BKE_libblock_free(&G.main->lamp, lamp); RNA_POINTER_INVALIDATE(lamp_ptr); } else { @@ -311,11 +312,11 @@ static Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, con return ima; } -static void rna_Main_images_remove(Main *bmain, ReportList *reports, PointerRNA *image_ptr) +static void rna_Main_images_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *image_ptr) { Image *image = image_ptr->data; if (ID_REAL_USERS(image) <= 0) { - BKE_libblock_free(&bmain->image, image); + BKE_libblock_free(&G.main->image, image); RNA_POINTER_INVALIDATE(image_ptr); } else { @@ -330,11 +331,11 @@ static Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name) id_us_min(<->id); return lt; } -static void rna_Main_lattices_remove(Main *bmain, ReportList *reports, PointerRNA *lt_ptr) +static void rna_Main_lattices_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *lt_ptr) { Lattice *lt = lt_ptr->data; if (ID_REAL_USERS(lt) <= 0) { - BKE_libblock_free(&bmain->latt, lt); + BKE_libblock_free(&G.main->latt, lt); RNA_POINTER_INVALIDATE(lt_ptr); } else { @@ -349,11 +350,11 @@ static Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int typ id_us_min(&cu->id); return cu; } -static void rna_Main_curves_remove(Main *bmain, ReportList *reports, PointerRNA *cu_ptr) +static void rna_Main_curves_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *cu_ptr) { Curve *cu = cu_ptr->data; if (ID_REAL_USERS(cu) <= 0) { - BKE_libblock_free(&bmain->curve, cu); + BKE_libblock_free(&G.main->curve, cu); RNA_POINTER_INVALIDATE(cu_ptr); } else { @@ -368,11 +369,11 @@ static MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name) id_us_min(&mb->id); return mb; } -static void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, PointerRNA *mb_ptr) +static void rna_Main_metaballs_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *mb_ptr) { MetaBall *mb = mb_ptr->data; if (ID_REAL_USERS(mb) <= 0) { - BKE_libblock_free(&bmain->mball, mb); + BKE_libblock_free(&G.main->mball, mb); RNA_POINTER_INVALIDATE(mb_ptr); } else { @@ -415,11 +416,11 @@ static Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int typ id_us_min(&tex->id); return tex; } -static void rna_Main_textures_remove(Main *bmain, ReportList *reports, PointerRNA *tex_ptr) +static void rna_Main_textures_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *tex_ptr) { Tex *tex = tex_ptr->data; if (ID_REAL_USERS(tex) <= 0) { - BKE_libblock_free(&bmain->tex, tex); + BKE_libblock_free(&G.main->tex, tex); RNA_POINTER_INVALIDATE(tex_ptr); } else { @@ -434,11 +435,11 @@ static Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name) id_us_min(&brush->id); return brush; } -static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, PointerRNA *brush_ptr) +static void rna_Main_brushes_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *brush_ptr) { Brush *brush = brush_ptr->data; if (ID_REAL_USERS(brush) <= 0) { - BKE_libblock_free(&bmain->brush, brush); + BKE_libblock_free(&G.main->brush, brush); RNA_POINTER_INVALIDATE(brush_ptr); } else { @@ -453,11 +454,11 @@ static World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name) id_us_min(&world->id); return world; } -static void rna_Main_worlds_remove(Main *bmain, ReportList *reports, PointerRNA *world_ptr) +static void rna_Main_worlds_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *world_ptr) { Group *world = world_ptr->data; if (ID_REAL_USERS(world) <= 0) { - BKE_libblock_free(&bmain->world, world); + BKE_libblock_free(&G.main->world, world); RNA_POINTER_INVALIDATE(world_ptr); } else { @@ -470,11 +471,11 @@ static Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name) { return add_group(name); } -static void rna_Main_groups_remove(Main *bmain, PointerRNA *group_ptr) +static void rna_Main_groups_remove(Main *UNUSED(bmain), PointerRNA *group_ptr) { Group *group = group_ptr->data; BKE_group_unlink(group); - BKE_libblock_free(&bmain->group, group); + BKE_libblock_free(&G.main->group, group); RNA_POINTER_INVALIDATE(group_ptr); } @@ -484,11 +485,11 @@ static Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name) id_us_min(&speaker->id); return speaker; } -static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, PointerRNA *speaker_ptr) +static void rna_Main_speakers_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *speaker_ptr) { Speaker *speaker = speaker_ptr->data; if (ID_REAL_USERS(speaker) <= 0) { - BKE_libblock_free(&bmain->speaker, speaker); + BKE_libblock_free(&G.main->speaker, speaker); RNA_POINTER_INVALIDATE(speaker_ptr); } else { @@ -501,11 +502,11 @@ static Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name) { return BKE_text_add(name); } -static void rna_Main_texts_remove(Main *bmain, PointerRNA *text_ptr) +static void rna_Main_texts_remove(Main *UNUSED(bmain), PointerRNA *text_ptr) { Text *text = text_ptr->data; - BKE_text_unlink(bmain, text); - BKE_libblock_free(&bmain->text, text); + BKE_text_unlink(G.main, text); + BKE_libblock_free(&G.main->text, text); RNA_POINTER_INVALIDATE(text_ptr); } @@ -529,11 +530,11 @@ static bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name) id_us_min(&arm->id); return arm; } -static void rna_Main_armatures_remove(Main *bmain, ReportList *reports, PointerRNA *arm_ptr) +static void rna_Main_armatures_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *arm_ptr) { bArmature *arm = arm_ptr->data; if (ID_REAL_USERS(arm) <= 0) { - BKE_libblock_free(&bmain->armature, arm); + BKE_libblock_free(&G.main->armature, arm); RNA_POINTER_INVALIDATE(arm_ptr); } else { @@ -549,11 +550,11 @@ static bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name) act->id.flag &= ~LIB_FAKEUSER; return act; } -static void rna_Main_actions_remove(Main *bmain, ReportList *reports, PointerRNA *act_ptr) +static void rna_Main_actions_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *act_ptr) { bAction *act = act_ptr->data; if (ID_REAL_USERS(act) <= 0) { - BKE_libblock_free(&bmain->action, act); + BKE_libblock_free(&G.main->action, act); RNA_POINTER_INVALIDATE(act_ptr); } else { @@ -595,11 +596,11 @@ static MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *repor return clip; } -static void rna_Main_movieclips_remove(Main *bmain, PointerRNA *clip_ptr) +static void rna_Main_movieclips_remove(Main *UNUSED(bmain), PointerRNA *clip_ptr) { MovieClip *clip = clip_ptr->data; - BKE_movieclip_unlink(bmain, clip); - BKE_libblock_free(&bmain->movieclip, clip); + BKE_movieclip_unlink(G.main, clip); + BKE_libblock_free(&G.main->movieclip, clip); RNA_POINTER_INVALIDATE(clip_ptr); } @@ -612,11 +613,11 @@ static Mask *rna_Main_mask_new(Main *UNUSED(bmain), const char *name) return mask; } -static void rna_Main_masks_remove(Main *bmain, PointerRNA *mask_ptr) +static void rna_Main_masks_remove(Main *UNUSED(bmain), PointerRNA *mask_ptr) { Mask *mask = mask_ptr->data; - BKE_mask_free(bmain, mask); - BKE_libblock_free(&bmain->mask, mask); + BKE_mask_free(G.main, mask); + BKE_libblock_free(&G.main->mask, mask); RNA_POINTER_INVALIDATE(mask_ptr); } |