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