libbe: ui_color() now works without UI connection.

* Since the app_server is a BApplication, too, now, Workspaces would
  trigger this problem.
* Now it checks whether the shared memory is actually set, and only
  uses it in this case. This will also fix using ui_color() in any
  BServer without UI connection.
This commit is contained in:
Axel Dörfler
2015-07-24 12:15:53 +02:00
parent 4fbe048e4c
commit 239f85731e
2 changed files with 16 additions and 14 deletions
+2 -1
View File
@@ -343,11 +343,12 @@ BApplication::_InitData(const char* signature, bool initGUI, status_t* _error)
{
DBG(OUT("BApplication::InitData(`%s', %p)\n", signature, _error));
// check whether there exists already an application
if (be_app)
if (be_app != NULL)
debugger("2 BApplication objects were created. Only one is allowed.");
fServerLink = new BPrivate::PortLink(-1, -1);
fServerAllocator = NULL;
fServerReadOnlyMemory = NULL;
fInitialWorkspace = 0;
//fDraggedMessage = NULL;
fReadyToRunCalled = false;
+4 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2010, Haiku, Inc.
* Copyright 2001-2015, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -1076,10 +1076,11 @@ ui_color(color_which which)
return make_color(0, 0, 0);
}
if (be_app) {
if (be_app != NULL) {
server_read_only_memory* shared
= BApplication::Private::ServerReadOnlyMemory();
return shared->colors[index];
if (shared != NULL)
return shared->colors[index];
}
return kDefaultColors[index];