mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
x11: Use Atoms when constructing a new MetaX11SelectionOutputStream
This was pointlessly being converted between atom and string and back,
which with the switch from gdk_x11_get_xatom_name() to XGetAtomName()
also introduced a leak for every XGetAtomName() call.
Fixes: e66f4396e
("x11: Avoid GDK API in X11 selections")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2957>
This commit is contained in:
parent
01ae1d32ee
commit
94bd5c7319
@ -34,10 +34,10 @@ G_DECLARE_FINAL_TYPE (MetaX11SelectionOutputStream,
|
|||||||
|
|
||||||
GOutputStream * meta_x11_selection_output_stream_new (MetaX11Display *x11_display,
|
GOutputStream * meta_x11_selection_output_stream_new (MetaX11Display *x11_display,
|
||||||
Window window,
|
Window window,
|
||||||
const char *selection,
|
Atom selection,
|
||||||
const char *target,
|
Atom target,
|
||||||
const char *property,
|
Atom property,
|
||||||
const char *type,
|
Atom type,
|
||||||
int format,
|
int format,
|
||||||
gulong timestamp);
|
gulong timestamp);
|
||||||
|
|
||||||
|
@ -657,10 +657,10 @@ meta_x11_selection_output_stream_xevent (MetaX11SelectionOutputStream *stream,
|
|||||||
GOutputStream *
|
GOutputStream *
|
||||||
meta_x11_selection_output_stream_new (MetaX11Display *x11_display,
|
meta_x11_selection_output_stream_new (MetaX11Display *x11_display,
|
||||||
Window requestor,
|
Window requestor,
|
||||||
const char *selection,
|
Atom selection,
|
||||||
const char *target,
|
Atom target,
|
||||||
const char *property,
|
Atom property,
|
||||||
const char *type,
|
Atom type,
|
||||||
int format,
|
int format,
|
||||||
gulong timestamp)
|
gulong timestamp)
|
||||||
{
|
{
|
||||||
@ -675,10 +675,10 @@ meta_x11_selection_output_stream_new (MetaX11Display *x11_display,
|
|||||||
|
|
||||||
priv->x11_display = x11_display;
|
priv->x11_display = x11_display;
|
||||||
priv->xwindow = requestor;
|
priv->xwindow = requestor;
|
||||||
priv->xselection = XInternAtom (x11_display->xdisplay, selection, False);
|
priv->xselection = selection;
|
||||||
priv->xtarget = XInternAtom (x11_display->xdisplay, target, False);
|
priv->xtarget = target;
|
||||||
priv->xproperty = XInternAtom (x11_display->xdisplay, property, False);
|
priv->xproperty = property;
|
||||||
priv->xtype = XInternAtom (x11_display->xdisplay, type, False);
|
priv->xtype = type;
|
||||||
priv->format = format;
|
priv->format = format;
|
||||||
priv->timestamp = timestamp;
|
priv->timestamp = timestamp;
|
||||||
|
|
||||||
|
@ -248,11 +248,14 @@ meta_x11_selection_handle_selection_request (MetaX11Display *x11_display,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
output = meta_x11_selection_output_stream_new (x11_display, event->requestor,
|
output = meta_x11_selection_output_stream_new (x11_display,
|
||||||
XGetAtomName (xdisplay, event->selection),
|
event->requestor,
|
||||||
XGetAtomName (xdisplay, event->target),
|
event->selection,
|
||||||
XGetAtomName (xdisplay, event->property),
|
event->target,
|
||||||
"ATOM", 32, event->time);
|
event->property,
|
||||||
|
XInternAtom (xdisplay, "ATOM", False),
|
||||||
|
32,
|
||||||
|
event->time);
|
||||||
|
|
||||||
bytes = mimetypes_to_bytes (mimetypes, x11_display->xdisplay);
|
bytes = mimetypes_to_bytes (mimetypes, x11_display->xdisplay);
|
||||||
g_list_free_full (mimetypes, g_free);
|
g_list_free_full (mimetypes, g_free);
|
||||||
@ -284,10 +287,10 @@ meta_x11_selection_handle_selection_request (MetaX11Display *x11_display,
|
|||||||
{
|
{
|
||||||
output = meta_x11_selection_output_stream_new (x11_display,
|
output = meta_x11_selection_output_stream_new (x11_display,
|
||||||
event->requestor,
|
event->requestor,
|
||||||
XGetAtomName (xdisplay, event->selection),
|
event->selection,
|
||||||
XGetAtomName (xdisplay, event->target),
|
event->target,
|
||||||
XGetAtomName (xdisplay, event->property),
|
event->property,
|
||||||
XGetAtomName (xdisplay, event->target),
|
event->target,
|
||||||
8, event->time);
|
8, event->time);
|
||||||
|
|
||||||
meta_selection_transfer_async (selection,
|
meta_selection_transfer_async (selection,
|
||||||
|
Loading…
Reference in New Issue
Block a user