* The way subdirectories for the input_server add-ons were defined was a bit

weird.
* Set fHandler to NULL in _UnregisterAddOns(), just in case it is called
  twice (which it probably never is... but be defensive).
* If a B_NODE_MONITOR message does not contain all the necessary fields,
  drop into the debugger when compiling in DEBUG mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28317 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-10-24 21:28:21 +00:00
parent 2643c0dddd
commit 944bc06060
1 changed files with 20 additions and 3 deletions

View File

@ -146,6 +146,9 @@ AddOnManager::SaveState()
}
// #pragma mark -
void
AddOnManager::_RegisterAddOns()
{
@ -168,11 +171,12 @@ AddOnManager::_RegisterAddOns()
B_COMMON_ADDONS_DIRECTORY,
B_BEOS_ADDONS_DIRECTORY
};
const char subDirectories[][24] = {
const char* subDirectories[] = {
"input_server/devices",
"input_server/filters",
"input_server/methods"
};
int32 subDirectoryCount = sizeof(subDirectories) / sizeof(const char*);
node_ref nref;
BDirectory directory;
@ -180,7 +184,7 @@ AddOnManager::_RegisterAddOns()
// when safemode, only B_BEOS_ADDONS_DIRECTORY is used
for (uint32 i = fSafeMode ? 2 : 0;
i < sizeof(directories) / sizeof(directory_which); i++) {
for (uint32 j = 0; j < sizeof(subDirectories) / sizeof(char[24]); j++) {
for (uint32 j = 0; j < subDirectoryCount; j++) {
if (find_directory(directories[i], &path) == B_OK
&& path.Append(subDirectories[j]) == B_OK
&& directory.SetTo(path.Path()) == B_OK
@ -202,6 +206,7 @@ AddOnManager::_UnregisterAddOns()
int32 exitValue;
wait_for_thread(fAddOnMonitor->Thread(), &exitValue);
delete fHandler;
fHandler = NULL;
// We have to stop manually the add-ons because the monitor doesn't
// disable them on exit
@ -500,6 +505,9 @@ AddOnManager::_RegisterMethod(BInputServerMethod* method, const entry_ref& ref,
}
// #pragma mark -
void
AddOnManager::_UnloadReplicant()
{
@ -830,8 +838,17 @@ AddOnManager::_HandleDeviceMonitor(BMessage* message)
const char* path;
const char* watchedPath;
if (message->FindString("watched_path", &watchedPath) != B_OK
|| message->FindString("path", &path) != B_OK)
|| message->FindString("path", &path) != B_OK) {
#if DEBUG
char string[1024];
sprintf(string, "message does not contain all fields - "
"watched_path: %d, path: %d\n",
message->HasString("watched_path"),
message->HasString("path"));
debugger(string);
#endif
return;
}
// Notify all watching devices