From 92b06e2f0386265c68f155df070436106521a538 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 18 Oct 2014 04:57:48 +0200 Subject: [PATCH] fix segfault at plugin-deregistration (due to #864) The actual problem is not resolved; the pluginloader should detect the duplicate and not add the handle to the database initially. Or it should add it as "duplicate" or "alternate implementation" Which probably means we need to coder some additional corner cases. But certainly not now, we have other more important stuff to do first... we've already lost the battle against Duke Nukem Forever :-P --- src/common/interfaceregistry.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/common/interfaceregistry.c b/src/common/interfaceregistry.c index 75e05c17b..0b2959d13 100644 --- a/src/common/interfaceregistry.c +++ b/src/common/interfaceregistry.c @@ -189,9 +189,20 @@ lumiera_interfaceregistry_bulkremove_interfaces (LumieraInterface* self) TRACE (interfaceregistry, "interface %s, version %d, instance %s", (*self)->interface, (*self)->version, (*self)->name); LumieraInterfacenode node = (LumieraInterfacenode) psplay_find (lumiera_interfaceregistry, *self, 0); - REQUIRE (node->refcnt == 0, "but is %d", node->refcnt); - - lumiera_interfacenode_delete ((LumieraInterfacenode) psplay_remove (lumiera_interfaceregistry, &node->node)); + if (node) + { + REQUIRE (node->refcnt == 0, "but is %d", node->refcnt); + lumiera_interfacenode_delete ((LumieraInterfacenode) psplay_remove (lumiera_interfaceregistry, &node->node)); + } + else + { + ///////////TICKET #864 : should not happen but does happen in practice, e.g. when there is a copy or another library linked against that module + /////////// Guess the pluginloader should not have added the duplicate into the interfaceregistry on discovery. + + WARN (interfaceregistry, "ENTRY NOT FOUND in interfaceregistry at clean-up of interface %s, instance %s" + , (*self)->interface + , (*self)->name); + } ++self; }