mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
gstglwindow_x11.c: Fix colormap leak
This fixes an X server side memory leak, this is normally not severe but in some circumstances where the glwindow is recreated frequently it can result in a very bad memory leak. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4054>
This commit is contained in:
parent
c34ac2a3e8
commit
13714d507d
1 changed files with 4 additions and 1 deletions
|
@ -62,6 +62,7 @@ struct _GstGLWindowX11Private
|
||||||
|
|
||||||
gboolean handle_events;
|
gboolean handle_events;
|
||||||
|
|
||||||
|
Colormap internal_colormap;
|
||||||
GstVideoRectangle render_rect;
|
GstVideoRectangle render_rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -216,7 +217,7 @@ gst_gl_window_x11_create_window (GstGLWindowX11 * window_x11)
|
||||||
win_attr.background_pixel = 0;
|
win_attr.background_pixel = 0;
|
||||||
win_attr.border_pixel = 0;
|
win_attr.border_pixel = 0;
|
||||||
|
|
||||||
win_attr.colormap =
|
window_x11->priv->internal_colormap = win_attr.colormap =
|
||||||
XCreateColormap (window_x11->device, window_x11->root,
|
XCreateColormap (window_x11->device, window_x11->root,
|
||||||
window_x11->visual_info->visual, AllocNone);
|
window_x11->visual_info->visual, AllocNone);
|
||||||
|
|
||||||
|
@ -272,6 +273,8 @@ gst_gl_window_x11_close (GstGLWindow * window)
|
||||||
|
|
||||||
XDestroyWindow (window_x11->device, window_x11->internal_win_id);
|
XDestroyWindow (window_x11->device, window_x11->internal_win_id);
|
||||||
|
|
||||||
|
XFreeColormap (window_x11->device, window_x11->priv->internal_colormap);
|
||||||
|
|
||||||
/* Ensure everything is sent immediatly */
|
/* Ensure everything is sent immediatly */
|
||||||
XSync (window_x11->device, FALSE);
|
XSync (window_x11->device, FALSE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue