Yesterday's memory free error fix in IMB_onehalf was wrong, it should
authorTon Roosendaal <ton@blender.org>
Fri, 28 Dec 2012 10:38:07 +0000 (10:38 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 28 Dec 2012 10:38:07 +0000 (10:38 +0000)
be fixed in the icons code!

source/blender/editors/interface/interface_icons.c
source/blender/imbuf/intern/scaling.c

index 31d1ad7a955fe679bcb83eb38ed29f0522c35d88..d146fe25187efa5f0339d92d0cde40fbb7741ed9 100644 (file)
@@ -575,9 +575,11 @@ static void init_internal_icons(void)
                                glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, b16buf->x, b16buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b16buf->rect);
                                
                                while (b16buf->x > 1) {
-                                       b16buf = IMB_onehalf(b16buf);
-                                       glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, b16buf->x, b16buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b16buf->rect);
+                                       ImBuf *nbuf = IMB_onehalf(b16buf);
+                                       glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, nbuf->x, nbuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nbuf->rect);
                                        level++;
+                                       IMB_freeImBuf(b16buf);
+                                       b16buf = nbuf;
                                }
                                
                                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
@@ -598,7 +600,7 @@ static void init_internal_icons(void)
        else
                icontype = ICON_TYPE_BUFFER;
        
-       if (b16buf) {
+       if (b32buf) {
                for (y = 0; y < ICON_GRID_ROWS; y++) {
                        for (x = 0; x < ICON_GRID_COLS; x++) {
                                def_internal_icon(b32buf, BIFICONID_FIRST + y * ICON_GRID_COLS + x,
index af51b4448aaf7bd442363274e0aef312bb752fa1..1e701b8d615ee8713d9c2e97f497f91e6f83b602 100644 (file)
@@ -360,8 +360,6 @@ ImBuf *IMB_onehalf(struct ImBuf *ibuf1)
        
        imb_onehalf_no_alloc(ibuf2, ibuf1);
        
-       IMB_freeImBuf(ibuf1);
-       
        return (ibuf2);
 }