From cba1bb6de508bdf0c57994947c83d5b7af0cfc96 Mon Sep 17 00:00:00 2001
From: Tim Mayberry <mojofunk@gmail.com>
Date: Wed, 6 Jun 2012 20:16:25 +1000
Subject: [PATCH 1/3] Remove redundant init and cleanup code from common test
 code

Calling PBD::EnumWriter::destroy means ARDOUR::init and setup_libpbd_enums need to be called again
to register types. If the call to EnumWriter::destroy is removed then ARDOUR::init and setup_libpbd_enums
no longer need to be called. EnumWriter::destroy should probably be added to ARDOUR::cleanup(or better yet PBD::cleanup)
and then called at the end of main. __attribute__ ((destructor)) could be used but that is not portable between
compilers so I'd prefer it wasn't.
---
 libs/ardour/test/test_needing_session.cc |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/libs/ardour/test/test_needing_session.cc b/libs/ardour/test/test_needing_session.cc
index 625d573..70e3362 100644
--- a/libs/ardour/test/test_needing_session.cc
+++ b/libs/ardour/test/test_needing_session.cc
@@ -6,8 +6,6 @@
 #include "ardour/audioengine.h"
 #include "test_needing_session.h"
 
-extern void setup_libpbd_enums ();
-
 using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
@@ -56,11 +54,8 @@ TestNeedingSession::setUp ()
 	string const test_session_path = "libs/ardour/test/test_session";
 	system (string_compose ("rm -rf %1", test_session_path).c_str());
 	
-	init (false, true);
 	SessionEvent::create_per_thread_pool ("test", 512);
 
-	setup_libpbd_enums ();
-
 	test_receiver.listen_to (error);
 	test_receiver.listen_to (info);
 	test_receiver.listen_to (fatal);
@@ -83,7 +78,6 @@ TestNeedingSession::tearDown ()
 	
 	delete _session;
 
-	EnumWriter::destroy ();
 	MIDI::Manager::destroy ();
 	AudioEngine::destroy ();
 }
-- 
1.7.7.6

