diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 20:38:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 20:38:48 +0400 |
commit | 0c7a25cd0ec8e1aaa853de6f5ec67e030917e15a (patch) | |
tree | 598c1092743b1c7d0707f5bf93a200a443197198 /source | |
parent | f403d9a2b1128565c503755668c7bc001ecb2eb3 (diff) |
patch [#28993] wm_window_match_do(): Fix crash on null pointer dereference
from Ola Jeppsson (olajep)
also some cleanup edits
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 8 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 52 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_text.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_apple.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 11 |
6 files changed, 41 insertions, 38 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index d3d6a658ede..cab621eeff7 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2368,7 +2368,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo /* ---springs */ }/*omit on snap */ }/*loop all bp's*/ -return 0; /*done fine*/ + return 0; /*done fine*/ } static void *exec_softbody_calc_forces(void *data) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 5060f55c533..73a71a25eba 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -93,8 +93,8 @@ #include "transform.h" -void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg); -int doEdgeSlide(TransInfo *t, float perc); +static void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg); +static int doEdgeSlide(TransInfo *t, float perc); /* ************************** SPACE DEPENDANT CODE **************************** */ @@ -1784,7 +1784,7 @@ void transformApply(bContext *C, TransInfo *t) t->context = NULL; } -void drawTransformApply(const bContext *C, struct ARegion *UNUSED(ar), void *arg) +static void drawTransformApply(const bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; @@ -4840,7 +4840,7 @@ void initEdgeSlide(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int doEdgeSlide(TransInfo *t, float perc) +static int doEdgeSlide(TransInfo *t, float perc) { SlideData *sld = t->customData; EditVert *ev, *nearest = sld->nearest; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index fa19d12d5ad..6e81200016d 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -90,23 +90,23 @@ /********************* PROTOTYPES ***********************/ -void setSnappingCallback(TransInfo *t); +static void setSnappingCallback(TransInfo *t); -void ApplySnapTranslation(TransInfo *t, float vec[3]); -void ApplySnapRotation(TransInfo *t, float *vec); -void ApplySnapResize(TransInfo *t, float *vec); +static void ApplySnapTranslation(TransInfo *t, float vec[3]); +static void ApplySnapRotation(TransInfo *t, float *vec); +static void ApplySnapResize(TransInfo *t, float *vec); -void CalcSnapGrid(TransInfo *t, float *vec); -void CalcSnapGeometry(TransInfo *t, float *vec); +static void CalcSnapGrid(TransInfo *t, float *vec); +static void CalcSnapGeometry(TransInfo *t, float *vec); -void TargetSnapMedian(TransInfo *t); -void TargetSnapCenter(TransInfo *t); -void TargetSnapClosest(TransInfo *t); -void TargetSnapActive(TransInfo *t); +static void TargetSnapMedian(TransInfo *t); +static void TargetSnapCenter(TransInfo *t); +static void TargetSnapClosest(TransInfo *t); +static void TargetSnapActive(TransInfo *t); -float RotationBetween(TransInfo *t, float p1[3], float p2[3]); -float TranslationBetween(TransInfo *t, float p1[3], float p2[3]); -float ResizeBetween(TransInfo *t, float p1[3], float p2[3]); +static float RotationBetween(TransInfo *t, float p1[3], float p2[3]); +static float TranslationBetween(TransInfo *t, float p1[3], float p2[3]); +static float ResizeBetween(TransInfo *t, float p1[3], float p2[3]); /****************** IMPLEMENTATIONS *********************/ @@ -483,7 +483,7 @@ void initSnapping(TransInfo *t, wmOperator *op) initSnappingMode(t); } -void setSnappingCallback(TransInfo *t) +static void setSnappingCallback(TransInfo *t) { t->tsnap.calcSnap = CalcSnapGeometry; @@ -584,14 +584,14 @@ void getSnapPoint(TransInfo *t, float vec[3]) /********************** APPLY **************************/ -void ApplySnapTranslation(TransInfo *t, float vec[3]) +static void ApplySnapTranslation(TransInfo *t, float vec[3]) { float point[3]; getSnapPoint(t, point); sub_v3_v3v3(vec, point, t->tsnap.snapTarget); } -void ApplySnapRotation(TransInfo *t, float *vec) +static void ApplySnapRotation(TransInfo *t, float *vec) { if (t->tsnap.target == SCE_SNAP_TARGET_CLOSEST) { *vec = t->tsnap.dist; @@ -603,7 +603,7 @@ void ApplySnapRotation(TransInfo *t, float *vec) } } -void ApplySnapResize(TransInfo *t, float vec[3]) +static void ApplySnapResize(TransInfo *t, float vec[3]) { if (t->tsnap.target == SCE_SNAP_TARGET_CLOSEST) { vec[0] = vec[1] = vec[2] = t->tsnap.dist; @@ -617,12 +617,12 @@ void ApplySnapResize(TransInfo *t, float vec[3]) /********************** DISTANCE **************************/ -float TranslationBetween(TransInfo *UNUSED(t), float p1[3], float p2[3]) +static float TranslationBetween(TransInfo *UNUSED(t), float p1[3], float p2[3]) { return len_v3v3(p1, p2); } -float RotationBetween(TransInfo *t, float p1[3], float p2[3]) +static float RotationBetween(TransInfo *t, float p1[3], float p2[3]) { float angle, start[3], end[3], center[3]; @@ -678,7 +678,7 @@ float RotationBetween(TransInfo *t, float p1[3], float p2[3]) return angle; } -float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) +static float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) { float d1[3], d2[3], center[3]; @@ -701,12 +701,12 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) /********************** CALC **************************/ -void CalcSnapGrid(TransInfo *t, float *UNUSED(vec)) +static void CalcSnapGrid(TransInfo *t, float *UNUSED(vec)) { snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS); } -void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) +static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) { if (t->spacetype == SPACE_VIEW3D) { @@ -866,7 +866,7 @@ void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) /********************** TARGET **************************/ -void TargetSnapCenter(TransInfo *t) +static void TargetSnapCenter(TransInfo *t) { // Only need to calculate once if ((t->tsnap.status & TARGET_INIT) == 0) @@ -881,7 +881,7 @@ void TargetSnapCenter(TransInfo *t) } } -void TargetSnapActive(TransInfo *t) +static void TargetSnapActive(TransInfo *t) { // Only need to calculate once if ((t->tsnap.status & TARGET_INIT) == 0) @@ -920,7 +920,7 @@ void TargetSnapActive(TransInfo *t) } } -void TargetSnapMedian(TransInfo *t) +static void TargetSnapMedian(TransInfo *t) { // Only need to calculate once if ((t->tsnap.status & TARGET_INIT) == 0) @@ -948,7 +948,7 @@ void TargetSnapMedian(TransInfo *t) } } -void TargetSnapClosest(TransInfo *t) +static void TargetSnapClosest(TransInfo *t) { // Only valid if a snap point has been selected if (t->tsnap.status & POINT_INIT) diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index a0d0bc088f7..9e3611b4cc5 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -42,7 +42,7 @@ #ifdef RNA_RUNTIME -int text_file_modified(Text *text); +int text_file_modified(Text *text); /* XXX bad level call */ static void rna_Text_filename_get(PointerRNA *ptr, char *value) { diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c index c19523cbaee..e17441873d5 100644 --- a/source/blender/windowmanager/intern/wm_apple.c +++ b/source/blender/windowmanager/intern/wm_apple.c @@ -98,8 +98,8 @@ static int checkAppleVideoCard(void) StandardAlert ( kAlertStopAlert, (ConstStr255Param) &inError, (ConstStr255Param)&inText,NULL,&junkHit); abort(); } -CGLDestroyRendererInfo (rend); -return 0; + CGLDestroyRendererInfo (rend); + return 0; } static void getMacAvailableBounds(short *top, short *left, short *bottom, short *right) diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 8d7e812a386..1a7031c7d31 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -155,8 +155,9 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist) CTX_wm_window_set(C, active_win); ED_editors_exit(C); - -return; + + /* just had return; here from r12991, this code could just get removed?*/ +#if 0 if(wm==NULL) return; if(G.fileflags & G_FILE_NO_UI) return; @@ -168,6 +169,7 @@ return; //BLI_addtail(screenbase, win->screen); } } +#endif } /* match old WM with new, 4 cases: @@ -193,9 +195,10 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist) /* we've read file without wm..., keep current one entirely alive */ if(G.main->wm.first==NULL) { + bScreen *screen= NULL; + /* when loading without UI, no matching needed */ - if(!(G.fileflags & G_FILE_NO_UI)) { - bScreen *screen= CTX_wm_screen(C); + if(!(G.fileflags & G_FILE_NO_UI) && (screen= CTX_wm_screen(C))) { /* match oldwm to new dbase, only old files */ for(wm= oldwmlist->first; wm; wm= wm->id.next) { |