From 719eb0bce8ea32578bff3f6377c44e8fe53c50cb Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 13 Nov 2021 00:48:27 +0100 Subject: [PATCH] Fixed a potential crash on application exit --- src/db/db/dbLibraryProxy.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/db/db/dbLibraryProxy.cc b/src/db/db/dbLibraryProxy.cc index 92e0e27b4..4008a1253 100644 --- a/src/db/db/dbLibraryProxy.cc +++ b/src/db/db/dbLibraryProxy.cc @@ -42,14 +42,18 @@ LibraryProxy::LibraryProxy (db::cell_index_type ci, db::Layout &layout, lib_id_t LibraryProxy::~LibraryProxy () { - if (layout ()) { - layout ()->unregister_lib_proxy (this); - } - if (db::LibraryManager::initialized ()) { - db::Library *lib = db::LibraryManager::instance ().lib (m_lib_id); - if (lib) { - lib->unregister_proxy (this, layout ()); + try { + if (layout ()) { + layout ()->unregister_lib_proxy (this); } + if (db::LibraryManager::initialized ()) { + db::Library *lib = db::LibraryManager::instance ().lib (m_lib_id); + if (lib) { + lib->unregister_proxy (this, layout ()); + } + } + } catch (...) { + // ignore exceptions (may happen due to broken PCell instantiations) } }