From 986faf42f5ddecb419d734f9d5e5732fca8b3aff Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 6 Jan 2024 03:56:57 +0100 Subject: [PATCH] Initialize some uninitialized variables This is only relevant when session load fails, by throwing an error, which is caught and calls destroy() before Session::setup_lua is called. --- libs/ardour/session.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 64e9d77676..a3df22404f 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -252,6 +252,13 @@ Session::Session (AudioEngine &eng, , pending_auto_loop (false) , _mempool ("Session", 3145728) , lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool)) + , _lua_run (0) + , _lua_add (0) + , _lua_del (0) + , _lua_list (0) + , _lua_load (0) + , _lua_save (0) + , _lua_cleanup (0) , _n_lua_scripts (0) , _io_plugins (new IOPlugList) , _butler (new Butler (*this)) @@ -679,7 +686,9 @@ Session::destroy () { /* unregister all lua functions, drop held references (if any) */ Glib::Threads::Mutex::Lock tm (lua_lock, Glib::Threads::TRY_LOCK); - (*_lua_cleanup)(); + if (_lua_cleanup) { + (*_lua_cleanup)(); + } lua.do_command ("Session = nil"); delete _lua_run; delete _lua_add;