Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2009-08-06 18:03:43 +0400
committerJoseph Eagar <joeedh@gmail.com>2009-08-06 18:03:43 +0400
commit7e6662e60ca9bd30dd11826ebceceea6dec85103 (patch)
treee2b32993b178bc2066a0f82707e35e8e11af227b
parent8f5d067c466c997291d946e098db5b3ad15a8576 (diff)
added a crash handler to dump the global undo state to file on segmentation fault. it saves to the current file path in G.sce + .crash.blend. note that this code is only enabled on release builds, it's #ifdef'd out if _DEBUG is defined. for users, if you were in edit mode when a crash happened, this will only save the mesh changes up to the time you entered edit mode.
-rw-r--r--source/blender/blenkernel/BKE_blender.h1
-rw-r--r--source/blender/blenkernel/BKE_bmesh.h3
-rw-r--r--source/blender/blenkernel/intern/blender.c18
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c10
-rw-r--r--source/blender/bmesh/operators/utils.c6
-rw-r--r--source/blender/editors/mesh/bmesh_tools.c2
-rw-r--r--source/creator/creator.c29
7 files changed, 53 insertions, 16 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 19b9c315939..52ea1484d28 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -75,6 +75,7 @@ extern void BKE_undo_name(struct bContext *C, const char *name);
extern void BKE_reset_undo(void);
extern char *BKE_undo_menu_string(void);
extern void BKE_undo_number(struct bContext *C, int nr);
+void BKE_undo_save(char *fname);
extern void BKE_undo_save_quit(void);
#ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h
index 957cd8ef9bd..fc43ae0f9a5 100644
--- a/source/blender/blenkernel/BKE_bmesh.h
+++ b/source/blender/blenkernel/BKE_bmesh.h
@@ -1,7 +1,7 @@
/**
* BKE_bmesh.h jan 2007
*
- * BMesh modeler structure and functions.
+ * (old) BMesh modeler structure and functions.
*
* $Id$
*
@@ -52,6 +52,7 @@ struct BME_Edge;
struct BME_Poly;
struct BME_Loop;
+/*NOTE: this is the bmesh 1.0 code. it's completely outdated.*/
/*Notes on further structure Cleanup:
-Remove the tflags, they belong in custom data layers
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 2728aa30e6e..e354cf14830 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -726,10 +726,18 @@ char *BKE_undo_menu_string(void)
/* saves quit.blend */
void BKE_undo_save_quit(void)
{
+ char str[FILE_MAXDIR+FILE_MAXFILE];
+
+ BLI_make_file_string("/", str, btempdir, "quit.blend");
+
+ BKE_undo_save(str);
+}
+
+void BKE_undo_save(char *fname)
+{
UndoElem *uel;
MemFileChunk *chunk;
int file;
- char str[FILE_MAXDIR+FILE_MAXFILE];
if( (U.uiflag & USER_GLOBALUNDO)==0) return;
@@ -742,9 +750,7 @@ void BKE_undo_save_quit(void)
/* no undo state to save */
if(undobase.first==undobase.last) return;
- BLI_make_file_string("/", str, btempdir, "quit.blend");
-
- file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
+ file = open(fname, O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
if(file == -1) {
//XXX error("Unable to save %s, check you have permissions", str);
return;
@@ -758,7 +764,7 @@ void BKE_undo_save_quit(void)
close(file);
- if(chunk) ; //XXX error("Unable to save %s, internal error", str);
- else printf("Saved session recovery to %s\n", str);
+ if(chunk) ; //XXX error("Unable to save %s, internal error", fname);
+ else printf("Saved session recovery to %s\n", fname);
}
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 3d38d1e541f..38a28e3e84b 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -383,8 +383,8 @@ void poly_rotate_plane(float normal[3], float (*verts)[3], int nverts)
void BM_Face_UpdateNormal(BMesh *bm, BMFace *f)
{
- float projverts[12][3];
- float (*proj)[3] = f->len < 12 ? projverts : MEM_mallocN(sizeof(float)*f->len*3, "projvertsn");
+ float projverts[200][3];
+ float (*proj)[3] = f->len < 200 ? projverts : MEM_mallocN(sizeof(float)*f->len*3, "projvertsn");
BMLoop *l = f->loopbase;
int i=0;
@@ -476,9 +476,9 @@ void bmesh_update_face_normal(BMesh *bm, BMFace *f, float (*projectverts)[3])
/*
* BMESH FLIP NORMAL
*
- * Reverses the winding of a faces
- * Note that this does *not* update the calculated
- * Normal
+ * Reverses the winding of a face.
+ * Note that this updates the calculated
+ * normal.
*/
void BM_flip_normal(BMesh *bm, BMFace *f)
{
diff --git a/source/blender/bmesh/operators/utils.c b/source/blender/bmesh/operators/utils.c
index 55ab3cc0405..b6dcb4feb53 100644
--- a/source/blender/bmesh/operators/utils.c
+++ b/source/blender/bmesh/operators/utils.c
@@ -271,9 +271,15 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op)
BM_Compute_Face_Center(bm, startf, cent);
+ /*make sure the starting face has the correct winding*/
if (cent[0]*startf->no[0] + cent[1]*startf->no[1] + cent[2]*startf->no[2] < 0.0)
BM_flip_normal(bm, startf);
+ /*now that we've found our starting face, make all connected faces
+ have the same winding. this is done recursively, using a manual
+ stack (if we use simple function recursion, we'd end up overloading
+ the stack on large meshes).*/
+
V_GROW(fstack);
fstack[0] = startf;
BMO_SetFlag(bm, startf, FACE_VIS);
diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c
index cba74f8d439..c008f1876f4 100644
--- a/source/blender/editors/mesh/bmesh_tools.c
+++ b/source/blender/editors/mesh/bmesh_tools.c
@@ -1743,5 +1743,5 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_int(ot->srna, "repeat", 1, 1, 200, "How many times to smooth the mesh", "", 1, INT_MAX);
+ RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX);
}
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 9034833563b..fb73872dc52 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -28,7 +28,7 @@
*/
#include <stdlib.h>
#include <string.h>
-
+#include <signal.h>
/* for setuid / getuid */
#ifdef __sgi
@@ -261,19 +261,42 @@ double PIL_check_seconds_timer(void);
}
}*/
+#ifndef _DEBUG
+int segmentation_handler(int sig)
+{
+ char fname[256];
+
+ if (!G.sce[0]) {
+ char str[FILE_MAXDIR+FILE_MAXFILE];
+
+ BLI_make_file_string("/", fname, btempdir, "quit.blend");
+ } else
+ sprintf(fname, "%s.crash.blend", G.sce);
+
+ BKE_undo_save(fname);
+
+ /*induce a real crash*/
+ signal(SIGSEGV, SIG_DFL);
+ *(int*)NULL = 0;
+}
+#endif
+
int main(int argc, char **argv)
{
SYS_SystemHandle syshandle;
bContext *C= CTX_create();
int a, i, stax, stay, sizx, sizy /*XXX, scr_init = 0*/;
-
#if defined(WIN32) || defined (__linux__)
int audio = 1;
#else
int audio = 0;
#endif
-
+#ifndef _DEBUG
+ signal(SIGSEGV, segmentation_handler);
+ signal(SIGFPE, segmentation_handler);
+#endif
+
#ifdef WITH_BINRELOC
br_init( NULL );
#endif