Handle workspace changes gracefully, without crashing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32261 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -337,18 +337,21 @@ BWindowScreen::SetColorList(rgb_color *list, int32 firstIndex, int32 lastIndex)
|
|||||||
for (int32 x = firstIndex; x <= lastIndex; x++) {
|
for (int32 x = firstIndex; x <= lastIndex; x++) {
|
||||||
fPalette[x] = list[x - firstIndex];
|
fPalette[x] = list[x - firstIndex];
|
||||||
// update our local palette as well
|
// update our local palette as well
|
||||||
|
|
||||||
colors[j++] = fPalette[x].red;
|
|
||||||
colors[j++] = fPalette[x].green;
|
|
||||||
colors[j++] = fPalette[x].blue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
j = 0;
|
||||||
|
for (int32 i = 0; i < 256; i++) {
|
||||||
|
colors[j++] = fPalette[i].red;
|
||||||
|
colors[j++] = fPalette[i].green;
|
||||||
|
colors[j++] = fPalette[i].blue;
|
||||||
|
}
|
||||||
|
|
||||||
if (fAddonImage >= 0) {
|
if (fAddonImage >= 0) {
|
||||||
set_indexed_colors setIndexedColors =
|
set_indexed_colors setIndexedColors =
|
||||||
(set_indexed_colors)fGetAccelerantHook(B_SET_INDEXED_COLORS,
|
(set_indexed_colors)fGetAccelerantHook(B_SET_INDEXED_COLORS,
|
||||||
NULL);
|
NULL);
|
||||||
if (setIndexedColors != NULL) {
|
if (setIndexedColors != NULL) {
|
||||||
setIndexedColors(lastIndex - firstIndex + 1, firstIndex,
|
setIndexedColors(255, 0,
|
||||||
colors, 0);
|
colors, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -719,14 +722,15 @@ status_t
|
|||||||
BWindowScreen::_Deactivate()
|
BWindowScreen::_Deactivate()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
_AssertDisplayMode(fOriginalDisplayMode);
|
|
||||||
|
|
||||||
if (fDebugState && !fDebugFirst) {
|
if (fDebugState && !fDebugFirst) {
|
||||||
_Suspend();
|
_Suspend();
|
||||||
SuspensionHook(false);
|
SuspensionHook(false);
|
||||||
} else
|
} else
|
||||||
ScreenConnected(false);
|
ScreenConnected(false);
|
||||||
|
|
||||||
|
_AssertDisplayMode(fOriginalDisplayMode);
|
||||||
|
|
||||||
_ResetAccelerantHooks();
|
_ResetAccelerantHooks();
|
||||||
|
|
||||||
be_app->ShowCursor();
|
be_app->ShowCursor();
|
||||||
@@ -747,12 +751,8 @@ BWindowScreen::_SetupAccelerantHooks()
|
|||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
if (fAddonImage < 0)
|
if (fAddonImage < 0)
|
||||||
status = _InitClone();
|
status = _InitClone();
|
||||||
else {
|
else
|
||||||
if (fWaitEngineIdle)
|
|
||||||
fWaitEngineIdle();
|
|
||||||
|
|
||||||
_ResetAccelerantHooks();
|
_ResetAccelerantHooks();
|
||||||
}
|
|
||||||
|
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
sWaitIdleHook = fWaitEngineIdle = (wait_engine_idle)fGetAccelerantHook(B_WAIT_ENGINE_IDLE, NULL);
|
sWaitIdleHook = fWaitEngineIdle = (wait_engine_idle)fGetAccelerantHook(B_WAIT_ENGINE_IDLE, NULL);
|
||||||
@@ -777,7 +777,9 @@ void
|
|||||||
BWindowScreen::_ResetAccelerantHooks()
|
BWindowScreen::_ResetAccelerantHooks()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
if (fWaitEngineIdle)
|
||||||
|
fWaitEngineIdle();
|
||||||
|
|
||||||
sFillRectHook = NULL;
|
sFillRectHook = NULL;
|
||||||
sBlitRectHook = NULL;
|
sBlitRectHook = NULL;
|
||||||
sTransparentBlitHook = NULL;
|
sTransparentBlitHook = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user