소스 검색

libobs-opengl: Add xcb message poll to empty out the queue

The xcb message queue is not currently emptied.  If errors are generated
by any void requests the message queue will simply fill up and messages
will never be deleted.

Due to a (currently unknown) other problem this happens for me, and
results in OBS using up all memory with a queue that will never be
emptied.

Here we add a poll loop that will empty the xcb message queue and
discard the messages.  While this means that errors are still not
handled, OBS wont end up crashing either.

Closes jp9000/obs-studio#675
Lasse Dalegaard 9 년 전
부모
커밋
ebd837d605
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      libobs-opengl/gl-x11.c

+ 6 - 1
libobs-opengl/gl-x11.c

@@ -587,7 +587,12 @@ extern void device_present(gs_device_t *device)
 		initialized = true;
 		initialized = true;
 	}
 	}
 
 
-	/* TODO: Handle XCB events. */
+	xcb_connection_t *xcb_conn = XGetXCBConnection(display);
+	xcb_generic_event_t *xcb_event;
+	while((xcb_event = xcb_poll_for_event(xcb_conn))) {
+		/* TODO: Handle XCB events. */
+		free(xcb_event);
+	}
 
 
 	switch (swap_type) {
 	switch (swap_type) {
 	case SWAP_TYPE_EXT:    glXSwapIntervalEXT(display, window, 0); break;
 	case SWAP_TYPE_EXT:    glXSwapIntervalEXT(display, window, 0); break;