Appearantly, there is a race condition when setting preferences, this fixes (one of) the crash(es?), but we should really fix the race condition, but I have no energy to get to know the code more. I'm thinking the PrefHandler class needs locking, since it is used everywhere, it is probably best to put the locking directly into the PrefHandler methods.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13789 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-07-21 12:59:23 +00:00
parent 6acca385f0
commit e4b3b04f99
1 changed files with 7 additions and 3 deletions

View File

@ -224,12 +224,16 @@ PrefHandler::getRGB(const char *key)
{
int r, g, b;
rgb_color col;
const char *s = mPrefContainer.FindString(key);
sscanf(s, "%d, %d, %d", &r, &g, &b);
if (const char *s = mPrefContainer.FindString(key)) {
sscanf(s, "%d, %d, %d", &r, &g, &b);
} else {
fprintf(stderr, "PrefHandler::getRGB(%s) - key not found\n", key);
r = g = b = 0;
}
col.red = r;
col.green = g;
col.blue = b;
col.alpha = 0;
col.alpha = 255;
return col;
}
/////////////////////////////////////////////////////////////////////////////