Skip to content

Commit

Permalink
Fix memory leaks/suboptimal logic and X errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Cubified committed Mar 6, 2019
1 parent df61948 commit 6e694a2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ To edit the order in which these modes are selected, adjust the `modes` variable
- Remove several unused dependencies, add option to compile without `stdio.h`
- Move all Xlib utility functions into `x.h`
- Move files into appropriate folders, cleaning up the appearance of the repository
- Add `above_enabled` check to avoid X error

### v1.2.0
- Add support for pre-mapped windows being tiled, thereby greatly improving the `reset` command
Expand Down Expand Up @@ -227,7 +228,6 @@ To edit the order in which these modes are selected, adjust the `modes` variable
- Investigate and resolve any remaining memory leaks
- Fix flickering upon dragging chromium tabs
- Fix incongruency between client-toggled and window manager-wide fullscreen
- Clean up util.h

## What Will (Likely) Never be Implemented

Expand Down
5 changes: 4 additions & 1 deletion include/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ void map_request(XEvent *e){
* Window with _NET_WM_STATE_ABOVE
* set always has precedence
*/
XMapRaised(dpy, above);
if(above_enabled &&
above != 0){
XMapRaised(dpy, above);
}

if(wintype == window_dock || wintype == window_taskbar){
multihead_addbar(ev->window);
Expand Down
9 changes: 8 additions & 1 deletion include/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,19 @@ void list_pop(node *root, node *elem){
* Frees an entire list
*/
void list_free(node *root){
/*
list_foreach_noroot(root){
if(itr->prev != NULL){
free(itr->prev);
}
}
free(itr);
free(itr);*/

list_foreach_reverse(root){
if(itr->next != NULL){
free(itr->next);
}
}
}

/*
Expand Down
2 changes: 2 additions & 0 deletions include/multihead.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ void multihead_resize(){
m->x = crtc_info->x;
m->y = crtc_info->y;
i++;
XRRFreeCrtcInfo(crtc_info);
}
XRRFreeScreenResources(screen_resources);
}

/*
Expand Down
1 change: 1 addition & 0 deletions include/x.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void x_init(){
root = DefaultRootWindow(dpy);
screen = DefaultScreenOfDisplay(dpy);
focused = 0;
above = 0;
bars = list_init();

XSetErrorHandler(&on_x_error);
Expand Down

0 comments on commit 6e694a2

Please sign in to comment.