tested running the cheat-sheet, found a number of segfaults

pressing escape in the outliner was also crashing (somehow it tried to exit the file selector)
This commit is contained in:
2009-09-21 09:17:14 +00:00
parent e2e0a864a8
commit 2379af27d1
7 changed files with 41 additions and 26 deletions

View File

@@ -738,9 +738,9 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot)
static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
{
ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
ParticleData *pa = psys->particles;
PTCacheEdit *edit = psys->edit;
PTCacheEditPoint *point = edit ? edit->points : NULL;
ParticleData *pa;
PTCacheEdit *edit;
PTCacheEditPoint *point;
PTCacheEditKey *ekey = NULL;
HairKey *key;
int i, k;
@@ -751,8 +751,11 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
if(!psys->part || psys->part->type != PART_HAIR)
return;
edit = psys->edit;
point= edit ? edit->points : NULL;
for(i=0; i<psys->totpart; i++,pa++) {
for(i=0, pa=psys->particles; i<psys->totpart; i++,pa++) {
if(point) {
ekey = point->keys;
point++;
@@ -820,9 +823,9 @@ void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
{
ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
ParticleData *pa = psys->particles;
PTCacheEdit *edit = psys->edit;
PTCacheEditPoint *point = edit ? edit->points : NULL;
ParticleData *pa;
PTCacheEdit *edit;
PTCacheEditPoint *point;
PTCacheEditKey *ekey;
HairKey *key;
BVHTreeFromMesh bvhtree;
@@ -836,7 +839,10 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
if(!psys || !psys->part || psys->part->type != PART_HAIR)
return;
edit= psys->edit;
point= edit ? edit->points : NULL;
if(psmd->dm->deformedOnly)
dm= psmd->dm;
else
@@ -852,7 +858,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
bvhtree_from_mesh_faces(&bvhtree, dm, 0.0, 2, 6);
for(i=0; i<psys->totpart; i++,pa++) {
for(i=0, pa= psys->particles; i<psys->totpart; i++,pa++) {
key = pa->hair;
nearest.index = -1;

View File

@@ -532,7 +532,7 @@ int file_operator_poll(bContext *C)
int poll = ED_operator_file_active(C);
SpaceFile *sfile= CTX_wm_space_file(C);
if (!sfile->op) poll= 0;
if (!sfile || !sfile->op) poll= 0;
return poll;
}

View File

@@ -623,7 +623,7 @@ ImBuf *ED_space_image_buffer(SpaceImage *sima)
{
ImBuf *ibuf;
if(sima->image) {
if(sima && sima->image) {
#if 0
if(sima->image->type==IMA_TYPE_R_RESULT && BIF_show_render_spare())
return BIF_render_spare_imbuf();

View File

@@ -4262,7 +4262,7 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *
/* it deselects Bases, so we have to call the clear function always after */
static void set_trans_object_base_flags(bContext *C, TransInfo *t)
{
Scene *sce = CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = t->view;
/*
@@ -4279,15 +4279,15 @@ static void set_trans_object_base_flags(bContext *C, TransInfo *t)
copy_baseflags(t->scene);
/* handle pending update events, otherwise they got copied below */
for (base= sce->base.first; base; base= base->next) {
for (base= scene->base.first; base; base= base->next) {
if(base->object->recalc)
object_handle_update(t->scene, base->object);
}
for (base= sce->base.first; base; base= base->next) {
for (base= scene->base.first; base; base= base->next) {
base->flag &= ~BA_WAS_SEL;
if(TESTBASELIB(v3d, base)) {
if(TESTBASELIB_BGMODE(v3d, base)) {
Object *ob= base->object;
Object *parsel= ob->parent;
@@ -4319,7 +4319,7 @@ static void set_trans_object_base_flags(bContext *C, TransInfo *t)
/* and we store them temporal in base (only used for transform code) */
/* this because after doing updates, the object->recalc is cleared */
for (base= sce->base.first; base; base= base->next) {
for (base= scene->base.first; base; base= base->next) {
if(base->object->recalc & OB_RECALC_OB)
base->flag |= BA_HAS_RECALC_OB;
if(base->object->recalc & OB_RECALC_DATA)
@@ -5319,7 +5319,7 @@ void createTransData(bContext *C, TransInfo *t)
{
View3D *v3d = t->view;
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if((t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==V3D_CAMOB)
if(rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==V3D_CAMOB)
{
t->flag |= T_CAMERA;
}

View File

@@ -353,7 +353,8 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) {
void BIF_selectTransformOrientationValue(bContext *C, int orientation) {
View3D *v3d = CTX_wm_view3d(C);
v3d->twmode = orientation;
if(v3d) /* currently using generic poll */
v3d->twmode = orientation;
}
EnumPropertyItem *BIF_enumTransformOrientation(bContext *C)

View File

@@ -1439,7 +1439,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
else {
sync= 0;
selectmode= ts->uv_selectmode;
sticky= sima->sticky;
sticky= sima ? sima->sticky : 1;
}
/* find nearest element */
@@ -2471,13 +2471,18 @@ static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obe
static int snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit)
{
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
Image *ima= sima->image;
Image *ima;
EditFace *efa;
MTFace *tface;
int width= 0, height= 0;
float w, h;
short change = 0;
if(!sima)
return 0;
ima= sima->image;
ED_space_image_size(sima, &width, &height);
w = (float)width;
h = (float)height;
@@ -2657,6 +2662,7 @@ static int hide_exec(bContext *C, wmOperator *op)
EditFace *efa;
MTFace *tf;
int swap= RNA_boolean_get(op->ptr, "unselected");
int facemode= sima ? sima->flag & SI_SELACTFACE : 0;
if(ts->uv_flag & UV_SYNC_SELECTION) {
EM_hide_mesh(em, swap);
@@ -2670,7 +2676,7 @@ static int hide_exec(bContext *C, wmOperator *op)
for(efa= em->faces.first; efa; efa= efa->next) {
if(efa->f & SELECT) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(sima->flag & SI_SELACTFACE) {
if(facemode) {
/* Pretend face mode */
if(( (efa->v4==NULL &&
( tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) == (TF_SEL1|TF_SEL2|TF_SEL3) ) ||
@@ -2715,7 +2721,7 @@ static int hide_exec(bContext *C, wmOperator *op)
if(efa->f & SELECT) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if(sima->flag & SI_SELACTFACE) {
if(facemode) {
if( (efa->v4==NULL &&
( tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) == (TF_SEL1|TF_SEL2|TF_SEL3) ) ||
( tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) == (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) ) {
@@ -2799,6 +2805,8 @@ static int reveal_exec(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
EditFace *efa;
MTFace *tf;
int facemode= sima ? sima->flag & SI_SELACTFACE : 0;
int stickymode= sima ? (sima->sticky != SI_STICKY_DISABLE) : 1;
/* call the mesh function if we are in mesh sync sel */
if(ts->uv_flag & UV_SYNC_SELECTION) {
@@ -2809,7 +2817,7 @@ static int reveal_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
if(sima->flag & SI_SELACTFACE) {
if(facemode) {
if(em->selectmode == SCE_SELECT_FACE) {
for(efa= em->faces.first; efa; efa= efa->next) {
if(!(efa->h) && !(efa->f & SELECT)) {
@@ -2821,7 +2829,7 @@ static int reveal_exec(bContext *C, wmOperator *op)
}
else {
/* enable adjacent faces to have disconnected UV selections if sticky is disabled */
if(sima->sticky == SI_STICKY_DISABLE) {
if(!stickymode) {
for(efa= em->faces.first; efa; efa= efa->next) {
if(!(efa->h) && !(efa->f & SELECT)) {
/* All verts must be unselected for the face to be selected in the UV view */

View File

@@ -1231,7 +1231,7 @@ void wm_event_do_handlers(bContext *C)
/* XXX hrmf, this gives reliable previous mouse coord for area change, feels bad?
doing it on ghost queue gives errors when mousemoves go over area borders */
if(doit && win->screen->subwinactive != win->screen->mainwin) {
if(doit && win->screen && win->screen->subwinactive != win->screen->mainwin) {
win->eventstate->prevx= event->x;
win->eventstate->prevy= event->y;
}
@@ -1244,7 +1244,7 @@ void wm_event_do_handlers(bContext *C)
}
/* only add mousemove when queue was read entirely */
if(win->addmousemove) {
if(win->addmousemove && win->eventstate) {
wmEvent event= *(win->eventstate);
event.type= MOUSEMOVE;
event.prevx= event.x;