* It's easier if we deal with just entry_refs instead of converting
to BEntry and back to entry_ref. This ommits a check to BEntry::InitCheck(), but AddOnMonitor should pass us only valid entry_refs. * Removed no longer valid TODO. TODO: There is still some problem with reloading add-ons, once they have been reloaded, they fail to instantiate properly, as if the entry_ref is pointing to the wrong node. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38328 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2009, Haiku. All rights reserved.
|
* Copyright 2004-2010, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -252,9 +252,7 @@ AddOnManager::_RegisterAddOns()
|
|||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
make_entry_ref(entryInfo->dir_nref.device,
|
make_entry_ref(entryInfo->dir_nref.device,
|
||||||
entryInfo->dir_nref.node, entryInfo->name, &ref);
|
entryInfo->dir_nref.node, entryInfo->name, &ref);
|
||||||
BEntry entry(&ref, false);
|
fManager->_RegisterAddOn(ref);
|
||||||
if (entry.InitCheck() == B_OK)
|
|
||||||
fManager->_RegisterAddOn(entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void AddOnDisabled(const add_on_entry_info* entryInfo)
|
virtual void AddOnDisabled(const add_on_entry_info* entryInfo)
|
||||||
@@ -262,9 +260,7 @@ AddOnManager::_RegisterAddOns()
|
|||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
make_entry_ref(entryInfo->dir_nref.device,
|
make_entry_ref(entryInfo->dir_nref.device,
|
||||||
entryInfo->dir_nref.node, entryInfo->name, &ref);
|
entryInfo->dir_nref.node, entryInfo->name, &ref);
|
||||||
BEntry entry(&ref, false);
|
fManager->_UnregisterAddOn(ref);
|
||||||
if (entry.InitCheck() == B_OK)
|
|
||||||
fManager->_UnregisterAddOn(entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void AddOnRemoved(const add_on_entry_info* entryInfo)
|
virtual void AddOnRemoved(const add_on_entry_info* entryInfo)
|
||||||
@@ -314,20 +310,16 @@ AddOnManager::_RegisterAddOns()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AddOnManager::_RegisterAddOn(BEntry& entry)
|
AddOnManager::_RegisterAddOn(const entry_ref& ref)
|
||||||
{
|
{
|
||||||
BPath path(&entry);
|
BPath path(&ref);
|
||||||
|
|
||||||
entry_ref ref;
|
|
||||||
status_t status = entry.GetRef(&ref);
|
|
||||||
if (status < B_OK)
|
|
||||||
return status;
|
|
||||||
|
|
||||||
printf("AddOnManager::_RegisterAddOn(): trying to load \"%s\"\n",
|
printf("AddOnManager::_RegisterAddOn(): trying to load \"%s\"\n",
|
||||||
path.Path());
|
path.Path());
|
||||||
|
|
||||||
ImageLoader loader(path);
|
ImageLoader loader(path);
|
||||||
if ((status = loader.InitCheck()) != B_OK)
|
status_t status = loader.InitCheck();
|
||||||
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
MediaPlugin* (*instantiate_plugin_func)();
|
MediaPlugin* (*instantiate_plugin_func)();
|
||||||
@@ -346,8 +338,6 @@ AddOnManager::_RegisterAddOn(BEntry& entry)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove any old formats describing this add-on!!
|
|
||||||
|
|
||||||
ReaderPlugin* reader = dynamic_cast<ReaderPlugin*>(plugin);
|
ReaderPlugin* reader = dynamic_cast<ReaderPlugin*>(plugin);
|
||||||
if (reader != NULL)
|
if (reader != NULL)
|
||||||
_RegisterReader(reader, ref);
|
_RegisterReader(reader, ref);
|
||||||
@@ -371,19 +361,14 @@ AddOnManager::_RegisterAddOn(BEntry& entry)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AddOnManager::_UnregisterAddOn(BEntry& entry)
|
AddOnManager::_UnregisterAddOn(const entry_ref& ref)
|
||||||
{
|
{
|
||||||
BPath path(&entry);
|
BPath path(&ref);
|
||||||
printf("AddOnManager::_UnregisterAddOn(): trying to unload \"%s\"\n",
|
printf("AddOnManager::_UnregisterAddOn(): trying to unload \"%s\"\n",
|
||||||
path.Path());
|
path.Path());
|
||||||
|
|
||||||
BAutolock locker(fLock);
|
BAutolock locker(fLock);
|
||||||
|
|
||||||
entry_ref ref;
|
|
||||||
status_t status = entry.GetRef(&ref);
|
|
||||||
if (status != B_OK)
|
|
||||||
return status;
|
|
||||||
|
|
||||||
// Remove any Readers exported by this add-on
|
// Remove any Readers exported by this add-on
|
||||||
reader_info* readerInfo;
|
reader_info* readerInfo;
|
||||||
for (fReaderList.Rewind(); fReaderList.GetNext(&readerInfo);) {
|
for (fReaderList.Rewind(); fReaderList.GetNext(&readerInfo);) {
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void _RegisterAddOns();
|
void _RegisterAddOns();
|
||||||
|
|
||||||
status_t _RegisterAddOn(BEntry& entry);
|
status_t _RegisterAddOn(const entry_ref& ref);
|
||||||
status_t _UnregisterAddOn(BEntry& entry);
|
status_t _UnregisterAddOn(const entry_ref& ref);
|
||||||
|
|
||||||
void _RegisterReader(ReaderPlugin* reader,
|
void _RegisterReader(ReaderPlugin* reader,
|
||||||
const entry_ref& ref);
|
const entry_ref& ref);
|
||||||
|
|||||||
Reference in New Issue
Block a user