Explorar el Código

fix memory leak issue caused by tag_preview

siduck76 hace 3 años
padre
commit
a10d00f9e0
Se han modificado 2 ficheros con 5 adiciones y 2 borrados
  1. 1 0
      chadwm/config.def.h
  2. 4 2
      chadwm/dwm.c

+ 1 - 0
chadwm/config.def.h

@@ -112,6 +112,7 @@ static const Layout layouts[] = {
     { ":::",      gaplessgrid },
     { "|M|",      centeredmaster },
     { ">M>",      centeredfloatingmaster },
+    { "|+|",      tatami },
     { "><>",      NULL },    /* no layout function means floating behavior */
 };
 

+ 4 - 2
chadwm/dwm.c

@@ -2683,6 +2683,9 @@ void switchtag(void) {
 		occ |= c->tags;
 	for (i = 0; i < LENGTH(tags); i++) {
 		if (selmon->tagset[selmon->seltags] & 1 << i) {
+                  	imlib_context_set_image(selmon->tag_images[i]);
+			imlib_free_image();
+                        selmon->tag_images[i] = NULL;
 			if (occ & 1 << i) {
 				selmon->tag_images[i] = imlib_create_image(sw, sh);
 				imlib_context_set_image(selmon->tag_images[i]);
@@ -2690,8 +2693,7 @@ void switchtag(void) {
 				imlib_context_set_visual(DefaultVisual(dpy, screen));
 				imlib_context_set_drawable(RootWindow(dpy, screen));
 				imlib_copy_drawable_to_image(0, selmon->mx, selmon->my, selmon->mw ,selmon->mh, 0, 0, 1);
-			} else
-				selmon->tag_images[i] = NULL;
+                        }
 		}
 	}
 }