[haiku-commits] haiku: hrev49346 - in src/kits: interface app

  • From: stpere@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 1 Jul 2015 21:20:46 +0200 (CEST)

hrev49346 adds 2 changesets to branch 'master'
old head: 4f2669e7ea29a98dd878e72b294bc45f82edc842
new head: 45888dab835677c5ca7081f38d93927db242f556
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=45888dab8356+%5E4f2669e7ea29

----------------------------------------------------------------------------

4cb7d0e75fd8: AboutWindow: Set initial font color in the TextView

45888dab8356: Crash fix in BMessage::ReplaceData()

The call to _CopyForWrite() invalidated the pointer previously assigned.
There was also an unrelated null-pointer derefence situation in the copy
constructor.

Fixes #3074 and CID 610886 and CID 610887.

[ Philippe Saint-Pierre <stpere@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 12 insertions(+), 11 deletions(-)
src/kits/app/Message.cpp | 19 ++++++++++---------
src/kits/interface/AboutWindow.cpp | 4 ++--

############################################################################

Commit: 4cb7d0e75fd8501180e359e68838eb8c2d69d38d
URL: http://cgit.haiku-os.org/haiku/commit/?id=4cb7d0e75fd8
Author: Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date: Tue Jun 30 18:20:47 2015 UTC

AboutWindow: Set initial font color in the TextView

----------------------------------------------------------------------------

diff --git a/src/kits/interface/AboutWindow.cpp
b/src/kits/interface/AboutWindow.cpp
index de72466..fa84cf5 100644
--- a/src/kits/interface/AboutWindow.cpp
+++ b/src/kits/interface/AboutWindow.cpp
@@ -170,13 +170,13 @@ AboutView::AboutView(const char* appName, const char*
signature)
fVersionView = new BStringView("version",
_GetVersionFromSignature(signature));

- fInfoView = new BTextView("info", B_WILL_DRAW);
+ rgb_color documentColor = ui_color(B_DOCUMENT_TEXT_COLOR);
+ fInfoView = new BTextView("info", NULL, &documentColor, B_WILL_DRAW);
fInfoView->SetExplicitMinSize(BSize(210.0, 160.0));
fInfoView->MakeEditable(false);
fInfoView->SetWordWrap(true);
fInfoView->SetInsets(5.0, 5.0, 5.0, 5.0);
fInfoView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
- fInfoView->SetHighColor(ui_color(B_DOCUMENT_TEXT_COLOR));
fInfoView->SetStylable(true);

BScrollView* infoViewScroller = new BScrollView(

############################################################################

Revision: hrev49346
Commit: 45888dab835677c5ca7081f38d93927db242f556
URL: http://cgit.haiku-os.org/haiku/commit/?id=45888dab8356
Author: Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date: Wed Jul 1 19:11:24 2015 UTC

Ticket: https://dev.haiku-os.org/ticket/3074

Crash fix in BMessage::ReplaceData()

The call to _CopyForWrite() invalidated the pointer previously assigned.
There was also an unrelated null-pointer derefence situation in the copy
constructor.

Fixes #3074 and CID 610886 and CID 610887.

----------------------------------------------------------------------------

diff --git a/src/kits/app/Message.cpp b/src/kits/app/Message.cpp
index 04df69f..e9a3a98 100644
--- a/src/kits/app/Message.cpp
+++ b/src/kits/app/Message.cpp
@@ -218,7 +218,7 @@ BMessage::operator=(const BMessage& other)
if (fFields == NULL) {
fHeader->field_count = 0;
fHeader->data_size = 0;
- } else
+ } else if (other.fFields != NULL)
memcpy(fFields, other.fFields, fieldsSize);
}

@@ -230,7 +230,7 @@ BMessage::operator=(const BMessage& other)
fHeader->field_count = 0;
free(fFields);
fFields = NULL;
- } else
+ } else if (other.fData != NULL)
memcpy(fData, other.fData, fHeader->data_size);
}

@@ -1965,20 +1965,21 @@ BMessage::ReplaceData(const char* name, type_code type,
int32 index,
if (numBytes <= 0 || data == NULL)
return B_BAD_VALUE;

+ status_t result;
+ if (fHeader->message_area >= 0) {
+ result = _CopyForWrite();
+ if (result != B_OK)
+ return result;
+ }
+
field_header* field = NULL;
- status_t result = _FindField(name, type, &field);
+ result = _FindField(name, type, &field);
if (result != B_OK)
return result;

if (index < 0 || (uint32)index >= field->count)
return B_BAD_INDEX;

- if (fHeader->message_area >= 0) {
- result = _CopyForWrite();
- if (result != B_OK)
- return result;
- }
-
if ((field->flags & FIELD_FLAG_FIXED_SIZE) != 0) {
ssize_t size = field->data_size / field->count;
if (size != numBytes)


Other related posts:

  • » [haiku-commits] haiku: hrev49346 - in src/kits: interface app - stpere