释放 xcb 库应该释放的内存
This commit is contained in:
@@ -99,6 +99,7 @@ static monitor_rect_t *detect_monitor_rect_by_xinerama(void) {
|
||||
}
|
||||
prev = m;
|
||||
}
|
||||
free(reply);
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -215,9 +216,9 @@ window_list_t *scan_window_list(void) {
|
||||
init_ewmh_extension();
|
||||
|
||||
xcb_query_tree_cookie_t cookie = xcb_query_tree(conn, screen->root);
|
||||
xcb_query_tree_reply_t *reply = xcb_query_tree_reply(conn, cookie, NULL);
|
||||
xcb_window_t *list = xcb_query_tree_children(reply);
|
||||
int len = xcb_query_tree_children_length(reply);
|
||||
xcb_query_tree_reply_t *tree_reply = xcb_query_tree_reply(conn, cookie, NULL);
|
||||
xcb_window_t *list = xcb_query_tree_children(tree_reply);
|
||||
int len = xcb_query_tree_children_length(tree_reply);
|
||||
|
||||
uint32_t count = 0;
|
||||
xcb_window_t temp_windoow_array[len];
|
||||
@@ -226,11 +227,11 @@ window_list_t *scan_window_list(void) {
|
||||
|
||||
xcb_get_window_attributes_cookie_t wa_cookie =
|
||||
xcb_get_window_attributes(conn, window);
|
||||
xcb_get_window_attributes_reply_t *reply =
|
||||
xcb_get_window_attributes_reply_t *attribute_reply =
|
||||
xcb_get_window_attributes_reply(conn, wa_cookie, NULL);
|
||||
uint8_t override_redirect = reply->override_redirect;
|
||||
uint8_t map_state = reply->map_state;
|
||||
free(reply);
|
||||
uint8_t override_redirect = attribute_reply->override_redirect;
|
||||
uint8_t map_state = attribute_reply->map_state;
|
||||
free(attribute_reply);
|
||||
if (override_redirect || map_state != XCB_MAP_STATE_VIEWABLE) continue;
|
||||
|
||||
xcb_window_t transient_for = XCB_NONE;
|
||||
@@ -242,6 +243,7 @@ window_list_t *scan_window_list(void) {
|
||||
temp_windoow_array[count] = window;
|
||||
count++;
|
||||
}
|
||||
free(tree_reply);
|
||||
|
||||
if (!count) return NULL;
|
||||
|
||||
@@ -271,6 +273,7 @@ void clean_xcb(void) {
|
||||
if (!ewmh_init_failed) {
|
||||
xcb_ewmh_connection_wipe(ewmh);
|
||||
}
|
||||
free(ewmh);
|
||||
ewmh_init_failed = false;
|
||||
ewmh = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user