mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-23 08:20:41 -08:00
Backport: Plug memory leak in GTK x-display-monitor-attributes-list
* src/frame.c (free_monitors) [USE_GTK]: Define in the GTK case as well. * src/xfns.c (x-display-monitor-attributes-list) [USE_GTK]: Plug memory leak. Use dupstring over xstrdup as gdk_monitor_get_model may return NULL.
This commit is contained in:
parent
e40f39bec3
commit
b3cab4199a
2 changed files with 8 additions and 3 deletions
|
|
@ -5533,8 +5533,8 @@ selected frame. This is useful when `make-pointer-invisible' is set. */)
|
||||||
|
|
||||||
#ifdef HAVE_WINDOW_SYSTEM
|
#ifdef HAVE_WINDOW_SYSTEM
|
||||||
|
|
||||||
# if (defined HAVE_NS \
|
# if (defined USE_GTK || defined HAVE_NS || defined HAVE_XINERAMA \
|
||||||
|| (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR)))
|
|| defined HAVE_XRANDR)
|
||||||
void
|
void
|
||||||
free_monitors (struct MonitorInfo *monitors, int n_monitors)
|
free_monitors (struct MonitorInfo *monitors, int n_monitors)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5009,7 +5009,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
|
||||||
mi->mm_height = height_mm;
|
mi->mm_height = height_mm;
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION (3, 22, 0)
|
#if GTK_CHECK_VERSION (3, 22, 0)
|
||||||
mi->name = g_strdup (gdk_monitor_get_model (monitor));
|
dupstring (&mi->name, (gdk_monitor_get_model (monitor)));
|
||||||
#elif GTK_CHECK_VERSION (2, 14, 0)
|
#elif GTK_CHECK_VERSION (2, 14, 0)
|
||||||
mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
|
mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -5020,6 +5020,11 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
|
||||||
primary_monitor,
|
primary_monitor,
|
||||||
monitor_frames,
|
monitor_frames,
|
||||||
source);
|
source);
|
||||||
|
#if GTK_CHECK_VERSION (2, 14, 0)
|
||||||
|
free_monitors (monitors, n_monitors);
|
||||||
|
#else
|
||||||
|
xfree (monitors);
|
||||||
|
#endif
|
||||||
unblock_input ();
|
unblock_input ();
|
||||||
#else /* not USE_GTK */
|
#else /* not USE_GTK */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue