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
This commit is contained in:
Jérôme Duval
2007-05-10 19:54:18 +00:00
parent 6be1e37d94
commit c0d5509623
+6 -2
View File
@@ -248,6 +248,8 @@ AddOnManager::UnregisterAddOn(BEntry& entry)
filter_info *pinfo; filter_info *pinfo;
for (fFilterList.Rewind(); fFilterList.GetNext(&pinfo);) { for (fFilterList.Rewind(); fFilterList.GetNext(&pinfo);) {
if (!strcmp(pinfo->ref.name, ref.name)) { if (!strcmp(pinfo->ref.name, ref.name)) {
BAutolock lock2(InputServer::gInputFilterListLocker);
InputServer::gInputFilterList.RemoveItem(pinfo->filter);
delete pinfo->filter; delete pinfo->filter;
if (pinfo->addon_image >= B_OK) if (pinfo->addon_image >= B_OK)
unload_add_on(pinfo->addon_image); unload_add_on(pinfo->addon_image);
@@ -256,9 +258,11 @@ AddOnManager::UnregisterAddOn(BEntry& entry)
} }
} }
} else if (pathString.FindFirst("input_server/methods") > 0) { } else if (pathString.FindFirst("input_server/methods") > 0) {
method_info *pinfo; method_info *pinfo = NULL;
for (fMethodList.Rewind(); fMethodList.GetNext(&pinfo);) { for (fMethodList.Rewind(); fMethodList.GetNext(&pinfo);) {
if (!strcmp(pinfo->ref.name, ref.name)) { if (!strcmp(pinfo->ref.name, ref.name)) {
BAutolock lock2(InputServer::gInputMethodListLocker);
InputServer::gInputMethodList.RemoveItem(pinfo->method);
delete pinfo->method; delete pinfo->method;
if (pinfo->addon_image >= B_OK) if (pinfo->addon_image >= B_OK)
unload_add_on(pinfo->addon_image); unload_add_on(pinfo->addon_image);
@@ -271,7 +275,7 @@ AddOnManager::UnregisterAddOn(BEntry& entry)
// we remove the method replicant // we remove the method replicant
BDeskbar().RemoveItem(REPLICANT_CTL_NAME); BDeskbar().RemoveItem(REPLICANT_CTL_NAME);
gInputServer->SetMethodReplicant(NULL); gInputServer->SetMethodReplicant(NULL);
} else { } else if (pinfo != NULL) {
BMessage msg(IS_REMOVE_METHOD); BMessage msg(IS_REMOVE_METHOD);
msg.AddInt32("cookie", (uint32)pinfo->method); msg.AddInt32("cookie", (uint32)pinfo->method);
if (gInputServer->MethodReplicant()) if (gInputServer->MethodReplicant())