[ShellGlobal] Fix double-free in get_primary_monitor

This commit is contained in:
Colin Walters 2010-04-05 11:39:37 -04:00
parent bae07700a1
commit cbcbd11ba0

View File

@ -1113,18 +1113,18 @@ shell_global_get_primary_monitor (ShellGlobal *global)
{
/* Prefer the laptop's internal screen if present */
output_name = gdk_screen_get_monitor_plug_name (screen, i);
if (output_name && g_ascii_strncasecmp (output_name, "LVDS", 4) == 0)
{
primary = i;
break;
}
if (output_name)
g_free (output_name);
{
gboolean is_lvds = g_ascii_strncasecmp (output_name, "LVDS", 4) == 0;
g_free (output_name);
if (is_lvds)
{
primary = i;
break;
}
}
}
if (output_name)
g_free (output_name);
gdk_screen_get_monitor_geometry (screen, primary, &rect);
return g_boxed_copy (GDK_TYPE_RECTANGLE, &rect);