x11-selection: Don't store copies of strings that are not being used
MetaX11SelectionOutputStream was storing copies of strings only to use them in init and then free them in finalize. This was also causing a small leak, because one of these strings was not freed. Instead of doing that just don't create these unnecessary copies in the first place. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1001
This commit is contained in:
parent
861e5caf8c
commit
c05019e232
@ -37,13 +37,9 @@ struct _MetaX11SelectionOutputStreamPrivate
|
|||||||
{
|
{
|
||||||
MetaX11Display *x11_display;
|
MetaX11Display *x11_display;
|
||||||
Window xwindow;
|
Window xwindow;
|
||||||
char *selection;
|
|
||||||
Atom xselection;
|
Atom xselection;
|
||||||
char *target;
|
|
||||||
Atom xtarget;
|
Atom xtarget;
|
||||||
char *property;
|
|
||||||
Atom xproperty;
|
Atom xproperty;
|
||||||
const char *type;
|
|
||||||
Atom xtype;
|
Atom xtype;
|
||||||
int format;
|
int format;
|
||||||
gulong timestamp;
|
gulong timestamp;
|
||||||
@ -515,10 +511,6 @@ meta_x11_selection_output_stream_finalize (GObject *object)
|
|||||||
g_cond_clear (&priv->cond);
|
g_cond_clear (&priv->cond);
|
||||||
g_mutex_clear (&priv->mutex);
|
g_mutex_clear (&priv->mutex);
|
||||||
|
|
||||||
g_free (priv->selection);
|
|
||||||
g_free (priv->target);
|
|
||||||
g_free (priv->property);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_x11_selection_output_stream_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_x11_selection_output_stream_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,14 +598,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->selection = g_strdup (selection);
|
priv->xselection = XInternAtom (x11_display->xdisplay, selection, False);
|
||||||
priv->xselection = XInternAtom (x11_display->xdisplay, priv->selection, False);
|
priv->xtarget = XInternAtom (x11_display->xdisplay, target, False);
|
||||||
priv->target = g_strdup (target);
|
priv->xproperty = XInternAtom (x11_display->xdisplay, property, False);
|
||||||
priv->xtarget = XInternAtom (x11_display->xdisplay, priv->target, False);
|
priv->xtype = XInternAtom (x11_display->xdisplay, type, False);
|
||||||
priv->property = g_strdup (property);
|
|
||||||
priv->xproperty = XInternAtom (x11_display->xdisplay, priv->property, False);
|
|
||||||
priv->type = g_strdup (type);
|
|
||||||
priv->xtype = XInternAtom (x11_display->xdisplay, priv->type, False);
|
|
||||||
priv->format = format;
|
priv->format = format;
|
||||||
priv->timestamp = timestamp;
|
priv->timestamp = timestamp;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user