summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-10-23 11:18:52 +0200
committerrbuj <[email protected]>2021-10-23 11:18:52 +0200
commit9df10251bc3c9db865dbe61a6f7d28998003f42f (patch)
tree0a3f7e0e643692657f793b64586e498bc71db0fb
parent34aafe51a3b610a1f3b957b92141f49574e833d5 (diff)
downloadmate-session-manager-mate-session-ml.tar.bz2
mate-session-manager-mate-session-ml.tar.xz
mate-session: fix memory leakmate-session-ml
-rw-r--r--mate-session/gsm-manager.c8
-rw-r--r--mate-session/main.c11
2 files changed, 12 insertions, 7 deletions
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c
index 9b5374e..b2106c4 100644
--- a/mate-session/gsm-manager.c
+++ b/mate-session/gsm-manager.c
@@ -145,7 +145,7 @@ typedef struct {
GSettings *settings_lockdown;
GSettings *settings_screensaver;
- const char *renderer;
+ char *renderer;
DBusGProxy *bus_proxy;
DBusGConnection *connection;
@@ -1697,7 +1697,8 @@ _gsm_manager_set_renderer (GsmManager *manager,
{
GsmManagerPrivate *priv;
priv = gsm_manager_get_instance_private (manager);
- priv->renderer = renderer;
+ g_free (priv->renderer);
+ priv->renderer = g_strdup (renderer);
}
static gboolean
@@ -2660,6 +2661,9 @@ gsm_manager_dispose (GObject *object)
g_object_unref (priv->settings_screensaver);
priv->settings_screensaver = NULL;
}
+
+ g_free (priv->renderer);
+
G_OBJECT_CLASS (gsm_manager_parent_class)->dispose (object);
}
diff --git a/mate-session/main.c b/mate-session/main.c
index 96c1092..fc2148e 100644
--- a/mate-session/main.c
+++ b/mate-session/main.c
@@ -83,7 +83,6 @@ static gboolean failsafe = FALSE;
static gboolean show_version = FALSE;
static gboolean debug = FALSE;
static gboolean disable_acceleration_check = FALSE;
-static char *gl_renderer = NULL;
static gboolean
initialize_gsettings (void)
@@ -575,7 +574,7 @@ static void set_overlay_scroll (void)
}
static gboolean
-check_gl (GError **error)
+check_gl (gchar **gl_renderer, GError **error)
{
int status;
char *argv[] = { LIBEXECDIR "/mate-session-check-accelerated", NULL };
@@ -585,7 +584,7 @@ check_gl (GError **error)
return TRUE;
}
- if (!g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL, &gl_renderer, NULL,
+ if (!g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL, gl_renderer, NULL,
&status, error)) {
return FALSE;
}
@@ -605,6 +604,7 @@ int main(int argc, char** argv)
GSettings* accessibility_settings;
MdmSignalHandler* signal_handler;
static char** override_autostart_dirs = NULL;
+ char* gl_renderer = NULL;
gboolean gl_failed = FALSE;
static GOptionEntry entries[] = {
@@ -670,7 +670,7 @@ int main(int argc, char** argv)
g_debug ("hardware acceleration check is disabled");
} else {
/* Check GL, if it doesn't work out then force software fallback */
- if (!check_gl (&error)) {
+ if (!check_gl (&gl_renderer, &error)) {
gl_failed = TRUE;
g_debug ("hardware acceleration check failed: %s",
@@ -678,7 +678,7 @@ int main(int argc, char** argv)
g_clear_error (&error);
if (g_getenv ("LIBGL_ALWAYS_SOFTWARE") == NULL) {
g_setenv ("LIBGL_ALWAYS_SOFTWARE", "1", TRUE);
- if (!check_gl (&error)) {
+ if (!check_gl (&gl_renderer, &error)) {
g_warning ("software acceleration check failed: %s",
error? error->message : "");
g_clear_error (&error);
@@ -759,6 +759,7 @@ int main(int argc, char** argv)
gsm_xsmp_server_start(xsmp_server);
_gsm_manager_set_renderer (manager, gl_renderer);
+ g_free (gl_renderer);
gsm_manager_start(manager);
gtk_main();