Merge branch 'master' into sam460ex

This commit is contained in:
François Revol
2012-12-07 10:59:31 +01:00
11 changed files with 68 additions and 48 deletions
+16 -8
View File
@@ -73,10 +73,14 @@ hgl_viewport(struct gl_context* glContext, GLint x, GLint y,
} }
static void static st_visual*
hgl_fill_st_visual(st_visual* stVisual, gl_config* glVisual) hgl_fill_st_visual(gl_config* glVisual)
{ {
memset(stVisual, 0, sizeof(*stVisual)); struct st_visual* stVisual = CALLOC_STRUCT(st_visual);
if (!stVisual) {
ERROR("%s: Couldn't allocate st_visual\n", __func__);
return NULL;
}
// Determine color format // Determine color format
if (glVisual->redBits == 8) { if (glVisual->redBits == 8) {
@@ -129,6 +133,8 @@ hgl_fill_st_visual(st_visual* stVisual, gl_config* glVisual)
if (glVisual->haveDepthBuffer || glVisual->haveStencilBuffer) if (glVisual->haveDepthBuffer || glVisual->haveStencilBuffer)
stVisual->buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK; stVisual->buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK;
return stVisual;
} }
@@ -292,11 +298,10 @@ GalliumContext::CreateContext(Bitmap *bitmap)
TRACE("stencilBits :\t%d\n", glVisual->stencilBits); TRACE("stencilBits :\t%d\n", glVisual->stencilBits);
// Convert Mesa calculated visual into state tracker visual // Convert Mesa calculated visual into state tracker visual
struct st_visual stVisual; context->stVisual = hgl_fill_st_visual(glVisual);
hgl_fill_st_visual(&stVisual, glVisual);
context->draw = new GalliumFramebuffer(&stVisual); context->draw = new GalliumFramebuffer(context->stVisual);
context->read = new GalliumFramebuffer(&stVisual); context->read = new GalliumFramebuffer(context->stVisual);
if (!context->draw || !context->read) { if (!context->draw || !context->read) {
ERROR("%s: Problem allocating framebuffer!\n", __func__); ERROR("%s: Problem allocating framebuffer!\n", __func__);
@@ -312,7 +317,7 @@ GalliumContext::CreateContext(Bitmap *bitmap)
memset(&attribs, 0, sizeof(attribs)); memset(&attribs, 0, sizeof(attribs));
attribs.options.force_glsl_extensions_warn = false; attribs.options.force_glsl_extensions_warn = false;
attribs.profile = ST_PROFILE_DEFAULT; attribs.profile = ST_PROFILE_DEFAULT;
attribs.visual = stVisual; attribs.visual = *context->stVisual;
attribs.major = 1; attribs.major = 1;
attribs.minor = 0; attribs.minor = 0;
//attribs.flags |= ST_CONTEXT_FLAG_DEBUG; //attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
@@ -418,6 +423,9 @@ GalliumContext::DestroyContext(context_id contextID)
if (fContext[contextID]->draw) if (fContext[contextID]->draw)
delete fContext[contextID]->draw; delete fContext[contextID]->draw;
if (fContext[contextID]->stVisual)
FREE(fContext[contextID]->stVisual);
if (fContext[contextID]->manager) if (fContext[contextID]->manager)
FREE(fContext[contextID]->manager); FREE(fContext[contextID]->manager);
@@ -32,8 +32,6 @@
DebugReportGenerator::DebugReportGenerator(::Team* team) DebugReportGenerator::DebugReportGenerator(::Team* team)
: :
BLooper("DebugReportGenerator"), BLooper("DebugReportGenerator"),
BReferenceable(),
fTeam(team), fTeam(team),
fArchitecture(team->GetArchitecture()), fArchitecture(team->GetArchitecture()),
fTeamDataSem(-1) fTeamDataSem(-1)
@@ -7,7 +7,6 @@
#include <Looper.h> #include <Looper.h>
#include <Referenceable.h>
#include "Team.h" #include "Team.h"
@@ -19,9 +18,7 @@ class Team;
class Thread; class Thread;
class DebugReportGenerator : public BLooper, public BReferenceable, class DebugReportGenerator : public BLooper, public Team::Listener {
public Team::Listener
{
public: public:
DebugReportGenerator(::Team* team); DebugReportGenerator(::Team* team);
~DebugReportGenerator(); ~DebugReportGenerator();
@@ -284,7 +284,6 @@ TeamDebugger::~TeamDebugger()
delete fMemoryBlockManager; delete fMemoryBlockManager;
fReportGenerator->Lock(); fReportGenerator->Lock();
fReportGenerator->Quit(); fReportGenerator->Quit();
delete fReportGenerator;
delete fWorker; delete fWorker;
delete fTeam; delete fTeam;
delete fFileManager; delete fFileManager;
+2 -1
View File
@@ -41,13 +41,14 @@ DwarfManager::LoadFile(const char* fileName, DwarfFile*& _file)
if (file == NULL) if (file == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
BReference<DwarfFile> fileReference(file, true);
status_t error = file->Load(fileName); status_t error = file->Load(fileName);
if (error != B_OK) { if (error != B_OK) {
delete file;
return error; return error;
} }
fFiles.Add(file); fFiles.Add(file);
fileReference.Detach();
// we keep the initial reference for ourselves // we keep the initial reference for ourselves
file->AcquireReference(); file->AcquireReference();
@@ -246,29 +246,28 @@ BListValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
if (strcmp(member->Name(), "fObjectList") == 0) { if (strcmp(member->Name(), "fObjectList") == 0) {
error = baseType->ResolveDataMemberLocation(member, error = baseType->ResolveDataMemberLocation(member,
*location, memberLocation); *location, memberLocation);
BReference<ValueLocation> locationRef(memberLocation, true);
if (error != B_OK) { if (error != B_OK) {
TRACE_LOCALS( TRACE_LOCALS(
"BListValueNode::ResolvedLocationAndValue(): " "BListValueNode::ResolvedLocationAndValue(): "
"failed to resolve location of header member: %s\n", "failed to resolve location of header member: %s\n",
strerror(error)); strerror(error));
delete memberLocation;
return error; return error;
} }
error = valueLoader->LoadValue(memberLocation, valueType, error = valueLoader->LoadValue(memberLocation, valueType,
false, fDataLocation); false, fDataLocation);
delete memberLocation;
if (error != B_OK) if (error != B_OK)
return error; return error;
} else if (strcmp(member->Name(), "fItemCount") == 0) { } else if (strcmp(member->Name(), "fItemCount") == 0) {
error = baseType->ResolveDataMemberLocation(member, error = baseType->ResolveDataMemberLocation(member,
*location, memberLocation); *location, memberLocation);
BReference<ValueLocation> locationRef(memberLocation, true);
if (error != B_OK) { if (error != B_OK) {
TRACE_LOCALS( TRACE_LOCALS(
"BListValueNode::ResolvedLocationAndValue(): " "BListValueNode::ResolvedLocationAndValue(): "
"failed to resolve location of header member: %s\n", "failed to resolve location of header member: %s\n",
strerror(error)); strerror(error));
delete memberLocation;
return error; return error;
} }
@@ -280,7 +279,6 @@ BListValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
BVariant listSize; BVariant listSize;
error = valueLoader->LoadValue(memberLocation, valueType, error = valueLoader->LoadValue(memberLocation, valueType,
false, listSize); false, listSize);
delete memberLocation;
if (error != B_OK) if (error != B_OK)
return error; return error;
+3 -4
View File
@@ -291,6 +291,7 @@ AppearancePrefView::MessageReceived(BMessage* msg)
_EnableCustomColors(true); _EnableCustomColors(true);
else else
_EnableCustomColors(false); _EnableCustomColors(false);
_ChangeColorScheme(newScheme); _ChangeColorScheme(newScheme);
modified = true; modified = true;
} }
@@ -393,14 +394,12 @@ AppearancePrefView::_SetCurrentColorScheme(BMenuField* field)
const char* currentSchemeName = NULL; const char* currentSchemeName = NULL;
color_scheme** schemes for (const color_scheme** schemes = gPredefinedColorSchemes;
= const_cast<color_scheme**>(gPredefinedColorSchemes); *schemes != NULL; schemes++) {
while (*schemes) {
if (gCustomColorScheme == **schemes) { if (gCustomColorScheme == **schemes) {
currentSchemeName = (*schemes)->name; currentSchemeName = (*schemes)->name;
break; break;
} }
schemes++;
} }
for (int32 i = 0; i < fColorSchemeField->Menu()->CountItems(); i++) { for (int32 i = 0; i < fColorSchemeField->Menu()->CountItems(); i++) {
+12 -15
View File
@@ -14,7 +14,7 @@
// Standard colors // Standard colors
const rgb_color kBlack= { 0, 0, 0, 255 }; const rgb_color kBlack = { 0, 0, 0, 255 };
const rgb_color kGreen = { 0, 255, 0, 255 }; const rgb_color kGreen = { 0, 255, 0, 255 };
const rgb_color kWhite = { 255, 255, 255, 255 }; const rgb_color kWhite = { 255, 255, 255, 255 };
const rgb_color kYellow = { 255, 255, 0, 255 }; const rgb_color kYellow = { 255, 255, 0, 255 };
@@ -35,7 +35,7 @@ const struct color_scheme kColorSchemeBlue = {
kYellow, kYellow,
{ 0, 0, 139, 255 }, { 0, 0, 139, 255 },
kBlack, kBlack,
kWhite, kYellow,
kBlack, kBlack,
{ 0, 139, 139, 255 }, { 0, 139, 139, 255 },
}; };
@@ -85,27 +85,24 @@ struct color_scheme gCustomColorScheme = {
}; };
const color_scheme* gPredefinedColorSchemes[] = { const color_scheme* gPredefinedColorSchemes[] = {
&kColorSchemeDefault, &kColorSchemeDefault,
&kColorSchemeBlue, &kColorSchemeBlue,
&kColorSchemeMidnight, &kColorSchemeMidnight,
&kColorSchemeProfessional, &kColorSchemeProfessional,
&kColorSchemeRetro, &kColorSchemeRetro,
&kColorSchemeSlate, &kColorSchemeSlate,
&gCustomColorScheme, &gCustomColorScheme,
NULL NULL
}; };
bool bool
color_scheme::operator==(const color_scheme& scheme) color_scheme::operator==(const color_scheme& scheme)
{ {
if (text_fore_color == scheme.text_fore_color return text_fore_color == scheme.text_fore_color
&& text_back_color == scheme.text_back_color && text_back_color == scheme.text_back_color
&& cursor_fore_color == scheme.cursor_fore_color && cursor_fore_color == scheme.cursor_fore_color
&& cursor_back_color == scheme.cursor_back_color && cursor_back_color == scheme.cursor_back_color
&& select_fore_color == scheme.select_fore_color && select_fore_color == scheme.select_fore_color
&& select_back_color == scheme.select_back_color) && select_back_color == scheme.select_back_color;
return true;
return false;
} }
+1 -1
View File
@@ -44,7 +44,7 @@ static const pref_defaults kTermDefaults[] = {
{ PREF_TEXT_FORE_COLOR, " 0, 0, 0" }, { PREF_TEXT_FORE_COLOR, " 0, 0, 0" },
{ PREF_TEXT_BACK_COLOR, "255, 255, 255" }, { PREF_TEXT_BACK_COLOR, "255, 255, 255" },
{ PREF_CURSOR_FORE_COLOR, " 0, 0, 0" }, { PREF_CURSOR_FORE_COLOR, "255, 255, 255" },
{ PREF_CURSOR_BACK_COLOR, " 0, 0, 0" }, { PREF_CURSOR_BACK_COLOR, " 0, 0, 0" },
{ PREF_SELECT_FORE_COLOR, "255, 255, 255" }, { PREF_SELECT_FORE_COLOR, "255, 255, 255" },
{ PREF_SELECT_BACK_COLOR, " 0, 0, 0" }, { PREF_SELECT_BACK_COLOR, " 0, 0, 0" },
+25 -2
View File
@@ -27,8 +27,31 @@ BReferenceable::BReferenceable()
BReferenceable::~BReferenceable() BReferenceable::~BReferenceable()
{ {
#ifdef DEBUG #ifdef DEBUG
if (fReferenceCount > 1) bool enterDebugger = false;
debugger("Deleted object which still had references.\n"); if (fReferenceCount == 1) {
// Simple heuristic to test if this object was allocated
// on the stack: check if this is within 1KB in either
// direction of the current stack address, and the reference
// count is 1. If so, we don't flag a warning since that would
// imply the object was allocated/destroyed on the stack
// without any references being acquired or released.
char test;
size_t testOffset = (addr_t)this - (addr_t)&test;
if (testOffset > 1024 || -testOffset > 1024) {
// might still be a stack object, check the thread's
// stack range to be sure.
thread_info info;
status_t result = get_thread_info(find_thread(NULL), &info);
if (result != B_OK || this < info.stack_base
|| this > info.stack_end) {
enterDebugger = true;
}
}
} else if (fReferenceCount != 0)
enterDebugger = true;
if (enterDebugger)
debugger("Deleted referenceable object with non-zero ref count.");
#endif #endif
} }
+6 -6
View File
@@ -17,16 +17,16 @@
static int static int
compare_private_data(const void* a, const void* b) compare_private_data(const void* a, const void* b)
{ {
return BString::Private::StringFromData((char*)a).Compare( return BString::Private::StringFromData(*(char**)a).Compare(
BString::Private::StringFromData((char*)b)); BString::Private::StringFromData(*(char**)b));
} }
static int static int
compare_private_data_ignore_case(const void* a, const void* b) compare_private_data_ignore_case(const void* a, const void* b)
{ {
return BString::Private::StringFromData((char*)a).ICompare( return BString::Private::StringFromData(*(char**)a).ICompare(
BString::Private::StringFromData((char*)b)); BString::Private::StringFromData(*(char**)b));
} }
@@ -367,7 +367,7 @@ BStringList::Flatten(void* buf, ssize_t size) const
if (size < FlattenedSize()) if (size < FlattenedSize())
return B_NO_MEMORY; return B_NO_MEMORY;
int32 count = CountStrings(); int32 count = CountStrings();
for (int32 i = 0; i < count; i++) { for (int32 i = 0; i < count; i++) {
BString item = StringAt(i); BString item = StringAt(i);
@@ -403,7 +403,7 @@ BStringList::Unflatten(type_code code, const void* buffer, ssize_t size)
} }
return B_OK; return B_OK;
} }
void void