Fix bug #1466: Crash on decimating non-manifold mesh in scons build.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 25 Jul 2004 10:49:25 +0000 (10:49 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 25 Jul 2004 10:49:25 +0000 (10:49 +0000)
- Enabled the NDEBUG define (to disable assertions) on all platforms in scons.
  This is already the default in Makefiles.
- Free MEdge data after decimating, it is not valid anymore.

SConstruct
source/blender/src/buttons_editing.c

index dcd450fb9e1acd586a1b4f87d17e780c0eb843ab..4a31262adcb8248682367ed6ac61bf6525efacf4 100644 (file)
@@ -264,7 +264,7 @@ elif sys.platform == 'cygwin':
     debug_flags = ['-O2', '-g']
     extra_flags = ['-pipe', '-mno-cygwin', '-mwindows', '-funsigned-char']
     cxxflags = []
     debug_flags = ['-O2', '-g']
     extra_flags = ['-pipe', '-mno-cygwin', '-mwindows', '-funsigned-char']
     cxxflags = []
-    defines = ['FREE_WINDOWS', 'NDEBUG']
+    defines = ['FREE_WINDOWS']
     warn_flags = ['-Wall', '-Wno-char-subscripts']
     platform_libs = ['png', 'jpeg', 'netapi32',
                      'opengl32', 'glu32', 'winmm',
     warn_flags = ['-Wall', '-Wno-char-subscripts']
     platform_libs = ['png', 'jpeg', 'netapi32',
                      'opengl32', 'glu32', 'winmm',
@@ -900,8 +900,7 @@ else:
 
 if user_options_dict['BUILD_BINARY'] == 'release':
     cflags = extra_flags + release_flags + warn_flags
 
 if user_options_dict['BUILD_BINARY'] == 'release':
     cflags = extra_flags + release_flags + warn_flags
-    if sys.platform == 'win32':
-        defines += ['NDEBUG']
+    defines += ['NDEBUG']
 else:
     cflags = extra_flags + debug_flags + warn_flags
     if sys.platform == 'win32':
 else:
     cflags = extra_flags + debug_flags + warn_flags
     if sys.platform == 'win32':
@@ -1671,4 +1670,4 @@ if enable_clean == 0: # only set up dependencies when not cleaning
        if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
                env.Depends(default_target, playername)
        env.Depends(default_target, appname)
        if user_options_dict['BUILD_BLENDER_PLAYER'] == 1:
                env.Depends(default_target, playername)
        env.Depends(default_target, appname)
-       
\ No newline at end of file
+       
index ef949e88fd4c270727908aa5fc25656df913f102..d2a967f74baf6bec93544ed8a4dfc36cc9b113c5 100644 (file)
@@ -207,8 +207,8 @@ static void decimate_faces(void)
        me= ob->data;
 
        /* add warning for vertex col and tfaces */
        me= ob->data;
 
        /* add warning for vertex col and tfaces */
-       if(me->tface || me->mcol || me->dvert) {
-               if(okee("This will remove UV coordinates, vertexcolors, and deform weights")==0) return;
+       if(me->tface || me->mcol || me->dvert || me->medge) {
+               if(okee("This will remove UV coordinates, vertexcolors, deform weights and edge data")==0) return;
                if(me->tface) MEM_freeN(me->tface);
                if(me->mcol) MEM_freeN(me->mcol);
                if(me->dvert) free_dverts(me->dvert, me->totvert);
                if(me->tface) MEM_freeN(me->tface);
                if(me->mcol) MEM_freeN(me->mcol);
                if(me->dvert) free_dverts(me->dvert, me->totvert);
@@ -348,6 +348,11 @@ static void decimate_apply(void)
                        dlm->mvert= NULL;
                        me->totvert= dlm->totvert;
 
                        dlm->mvert= NULL;
                        me->totvert= dlm->totvert;
 
+                       // edges
+                       if(me->medge) MEM_freeN(me->medge);
+                       me->medge = NULL;
+                       me->totedge = 0;
+
                        // faces
                        if(me->mface) MEM_freeN(me->mface);
                        me->mface= MEM_callocN(dlm->totface*sizeof(MFace), "mface");
                        // faces
                        if(me->mface) MEM_freeN(me->mface);
                        me->mface= MEM_callocN(dlm->totface*sizeof(MFace), "mface");