Parcourir la source

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 il y a 9 ans
Parent
commit
ebd837d605
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  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;