From b3ff25b8842fe7029b3b5072f4060e7f81a97a15 Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Fri, 25 Aug 2006 14:09:24 +0000
Subject: [PATCH] (output_def_body): take ownership of identifier back to C++.

---
 ChangeLog      | 3 +++
 lily/parser.yy | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 6222a53120..d1a80a4f8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-08-25  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+	* lily/parser.yy (output_def_body): take ownership of identifier
+	back to C++.
+
 	* Documentation/user/advanced-notation.itely (Metronome marks):
 	update use of \tempo in \midi.
 
diff --git a/lily/parser.yy b/lily/parser.yy
index 52356a44d0..17b0cd25a7 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -731,6 +731,7 @@ paper_block:
 		if ($$->lookup_variable (ly_symbol2scm ("is-paper")) != SCM_BOOL_T)
 		{
 			PARSER->parser_error (@1, _ ("need \\paper for paper block"));
+			$1->unprotect ();
 			$$ = get_paper (PARSER);
 		}
 	}
@@ -779,9 +780,11 @@ output_def_body:
 	}
 	| output_def_head_with_mode_switch '{' OUTPUT_DEF_IDENTIFIER 	{
 		$1->unprotect ();
+
 		Output_def *o = unsmob_output_def ($3);
 		o->input_origin_.set_spot (@$);
 		$$ = o;
+		$$->protect ();
 		PARSER->lexer_->remove_scope ();
 		PARSER->lexer_->add_scope (o->scope_);
 	}
-- 
2.39.5