瀏覽代碼

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;
 	}
 
-	/* 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) {
 	case SWAP_TYPE_EXT:    glXSwapIntervalEXT(display, window, 0); break;