From c0d55096233d3f06246c25e0ce4c9bd5c6f24cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 10 May 2007 19:54:18 +0000 Subject: [PATCH] remove filters and methods from their lists when unregistering fixes bug #1215 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21106 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/input/AddOnManager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/servers/input/AddOnManager.cpp b/src/servers/input/AddOnManager.cpp index 3cadf738c8..037838e730 100644 --- a/src/servers/input/AddOnManager.cpp +++ b/src/servers/input/AddOnManager.cpp @@ -248,6 +248,8 @@ AddOnManager::UnregisterAddOn(BEntry& entry) filter_info *pinfo; for (fFilterList.Rewind(); fFilterList.GetNext(&pinfo);) { if (!strcmp(pinfo->ref.name, ref.name)) { + BAutolock lock2(InputServer::gInputFilterListLocker); + InputServer::gInputFilterList.RemoveItem(pinfo->filter); delete pinfo->filter; if (pinfo->addon_image >= B_OK) unload_add_on(pinfo->addon_image); @@ -256,9 +258,11 @@ AddOnManager::UnregisterAddOn(BEntry& entry) } } } else if (pathString.FindFirst("input_server/methods") > 0) { - method_info *pinfo; + method_info *pinfo = NULL; for (fMethodList.Rewind(); fMethodList.GetNext(&pinfo);) { if (!strcmp(pinfo->ref.name, ref.name)) { + BAutolock lock2(InputServer::gInputMethodListLocker); + InputServer::gInputMethodList.RemoveItem(pinfo->method); delete pinfo->method; if (pinfo->addon_image >= B_OK) unload_add_on(pinfo->addon_image); @@ -271,7 +275,7 @@ AddOnManager::UnregisterAddOn(BEntry& entry) // we remove the method replicant BDeskbar().RemoveItem(REPLICANT_CTL_NAME); gInputServer->SetMethodReplicant(NULL); - } else { + } else if (pinfo != NULL) { BMessage msg(IS_REMOVE_METHOD); msg.AddInt32("cookie", (uint32)pinfo->method); if (gInputServer->MethodReplicant())