summaryrefslogtreecommitdiff
path: root/src/terminal.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2014-01-28 09:55:06 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2014-01-28 09:55:06 +0400
commit6affb4a8073e4ce8d5c94561ce5c4741c869d52e (patch)
tree1502330976a105446e0c8948ad21780a938b524d /src/terminal.c
parent0a60cc0dbcfc1d6c12f725038464584c66ca9dfb (diff)
downloademacs-6affb4a8073e4ce8d5c94561ce5c4741c869d52e.tar.gz
* terminal.c (initial_free_frame_resources): New function.
(init_initial_terminal): Install new hook to free face cache on initial frame and avoid memory leak. For details, see <http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01974.html>.
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 15e7e8a4474..d0a38b97bb4 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -500,7 +500,15 @@ selected frame's terminal). */)
return store_terminal_param (t, parameter, value);
}
-
+/* Initial frame has no device-dependent output data, but has
+ face cache which should be freed when the frame is deleted. */
+
+static void
+initial_free_frame_resources (struct frame *f)
+{
+ eassert (FRAME_INITIAL_P (f));
+ free_frame_faces (f);
+}
/* Create the bootstrap display terminal for the initial frame.
Returns a terminal of type output_initial. */
@@ -516,6 +524,7 @@ init_initial_terminal (void)
initial_terminal->name = xstrdup ("initial_terminal");
initial_terminal->kboard = initial_kboard;
initial_terminal->delete_terminal_hook = &delete_initial_terminal;
+ initial_terminal->delete_frame_hook = &initial_free_frame_resources;
/* All other hooks are NULL. */
return initial_terminal;