fix: 资源未释放

多次快速旋转屏幕会多次调用这里,之前的资源未释放会导致后面的连接不成功,读不到正确的屏幕信息。

Log: 修复屏幕参数获取错误的问题。
Change-Id: I4bb1961a0e4786de1272a3897578be9c97cfa3cb
This commit is contained in:
Zhang Qipeng 2021-01-29 14:28:34 +08:00
parent dd54b212f3
commit 81053b31c9

View File

@ -1747,6 +1747,12 @@ void MultiScreenWorker::updateScreenSize()
int screenNum;
xcb_connection_t *connection = xcb_connect(NULL, &screenNum);
/* Check for failure */
if (xcb_connection_has_error(connection)) {
xcb_disconnect(connection);
return;
}
/* Get the screen whose number is screenNum */
const xcb_setup_t *setup = xcb_get_setup(connection);
xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup);
@ -1760,6 +1766,8 @@ void MultiScreenWorker::updateScreenSize()
m_screenRawWidth = screen->width_in_pixels;
m_screenRawHeight = screen->height_in_pixels;
xcb_disconnect(connection);
}
void MultiScreenWorker::onTouchPress(int type, int x, int y, const QString &key)