* 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:
parent
2643c0dddd
commit
944bc06060
@ -146,6 +146,9 @@ AddOnManager::SaveState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AddOnManager::_RegisterAddOns()
|
AddOnManager::_RegisterAddOns()
|
||||||
{
|
{
|
||||||
@ -168,11 +171,12 @@ AddOnManager::_RegisterAddOns()
|
|||||||
B_COMMON_ADDONS_DIRECTORY,
|
B_COMMON_ADDONS_DIRECTORY,
|
||||||
B_BEOS_ADDONS_DIRECTORY
|
B_BEOS_ADDONS_DIRECTORY
|
||||||
};
|
};
|
||||||
const char subDirectories[][24] = {
|
const char* subDirectories[] = {
|
||||||
"input_server/devices",
|
"input_server/devices",
|
||||||
"input_server/filters",
|
"input_server/filters",
|
||||||
"input_server/methods"
|
"input_server/methods"
|
||||||
};
|
};
|
||||||
|
int32 subDirectoryCount = sizeof(subDirectories) / sizeof(const char*);
|
||||||
|
|
||||||
node_ref nref;
|
node_ref nref;
|
||||||
BDirectory directory;
|
BDirectory directory;
|
||||||
@ -180,7 +184,7 @@ AddOnManager::_RegisterAddOns()
|
|||||||
// when safemode, only B_BEOS_ADDONS_DIRECTORY is used
|
// when safemode, only B_BEOS_ADDONS_DIRECTORY is used
|
||||||
for (uint32 i = fSafeMode ? 2 : 0;
|
for (uint32 i = fSafeMode ? 2 : 0;
|
||||||
i < sizeof(directories) / sizeof(directory_which); i++) {
|
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
|
if (find_directory(directories[i], &path) == B_OK
|
||||||
&& path.Append(subDirectories[j]) == B_OK
|
&& path.Append(subDirectories[j]) == B_OK
|
||||||
&& directory.SetTo(path.Path()) == B_OK
|
&& directory.SetTo(path.Path()) == B_OK
|
||||||
@ -202,6 +206,7 @@ AddOnManager::_UnregisterAddOns()
|
|||||||
int32 exitValue;
|
int32 exitValue;
|
||||||
wait_for_thread(fAddOnMonitor->Thread(), &exitValue);
|
wait_for_thread(fAddOnMonitor->Thread(), &exitValue);
|
||||||
delete fHandler;
|
delete fHandler;
|
||||||
|
fHandler = NULL;
|
||||||
|
|
||||||
// We have to stop manually the add-ons because the monitor doesn't
|
// We have to stop manually the add-ons because the monitor doesn't
|
||||||
// disable them on exit
|
// disable them on exit
|
||||||
@ -500,6 +505,9 @@ AddOnManager::_RegisterMethod(BInputServerMethod* method, const entry_ref& ref,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AddOnManager::_UnloadReplicant()
|
AddOnManager::_UnloadReplicant()
|
||||||
{
|
{
|
||||||
@ -830,8 +838,17 @@ AddOnManager::_HandleDeviceMonitor(BMessage* message)
|
|||||||
const char* path;
|
const char* path;
|
||||||
const char* watchedPath;
|
const char* watchedPath;
|
||||||
if (message->FindString("watched_path", &watchedPath) != B_OK
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Notify all watching devices
|
// Notify all watching devices
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user