[haiku-commits] r38063 - in haiku/trunk/src/kits: interface support

  • From: yourpalal2@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 12 Aug 2010 16:50:58 +0200 (CEST)

Author: yourpalal
Date: 2010-08-12 16:50:57 +0200 (Thu, 12 Aug 2010)
New Revision: 38063
Changeset: http://dev.haiku-os.org/changeset/38063

Modified:
   haiku/trunk/src/kits/interface/SeparatorView.cpp
   haiku/trunk/src/kits/interface/View.cpp
   haiku/trunk/src/kits/support/Archivable.cpp
   haiku/trunk/src/kits/support/ArchivingManagers.h
Log:
Update BView to call debugger when passed a NULL archive for its archive 
constructor. This means there is no need to check for a NULL archive in 
BSeparatorView. Also update BUnarchiver and friends to be NULL safe. Pointed 
out by Adrien, fixes CID 1754.


Modified: haiku/trunk/src/kits/interface/SeparatorView.cpp
===================================================================
--- haiku/trunk/src/kits/interface/SeparatorView.cpp    2010-08-12 14:22:46 UTC 
(rev 38062)
+++ haiku/trunk/src/kits/interface/SeparatorView.cpp    2010-08-12 14:50:57 UTC 
(rev 38063)
@@ -84,9 +84,7 @@
                B_ALIGN_VERTICAL_CENTER)),
        fBorder(B_FANCY_BORDER)
 {
-       // TODO: Test this.
-       if (archive == NULL)
-               return;
+       // NULL archives will be caught by BView.
 
        const char* label;
        if (archive->FindString("_labelview", &label) == B_OK) {

Modified: haiku/trunk/src/kits/interface/View.cpp
===================================================================
--- haiku/trunk/src/kits/interface/View.cpp     2010-08-12 14:22:46 UTC (rev 
38062)
+++ haiku/trunk/src/kits/interface/View.cpp     2010-08-12 14:50:57 UTC (rev 
38063)
@@ -405,6 +405,8 @@
        BHandler(BUnarchiver::PrepareArchive(archive))
 {
        BUnarchiver unarchiver(archive);
+       if (!archive)
+               debugger("BView cannot be constructed from a NULL archive.");
 
        BRect frame;
        archive->FindRect("_frame", &frame);

Modified: haiku/trunk/src/kits/support/Archivable.cpp
===================================================================
--- haiku/trunk/src/kits/support/Archivable.cpp 2010-08-12 14:22:46 UTC (rev 
38062)
+++ haiku/trunk/src/kits/support/Archivable.cpp 2010-08-12 14:50:57 UTC (rev 
38063)
@@ -511,6 +511,9 @@
        if (BManagerBase::ManagerPointer(archive))
                return true;
 
+       if (!archive)
+               return false;
+
        // managed top level archives return here
        bool dummy;
        if (archive->FindBool(kManagedField, &dummy) == B_OK)

Modified: haiku/trunk/src/kits/support/ArchivingManagers.h
===================================================================
--- haiku/trunk/src/kits/support/ArchivingManagers.h    2010-08-12 14:22:46 UTC 
(rev 38062)
+++ haiku/trunk/src/kits/support/ArchivingManagers.h    2010-08-12 14:50:57 UTC 
(rev 38063)
@@ -43,6 +43,9 @@
        static BManagerBase*
        ManagerPointer(const BMessage* constArchive)
        {
+               if (!constArchive)
+                       return NULL;
+
                BMessage* archive = const_cast<BMessage*>(constArchive);
 
                return static_cast<BManagerBase*>(


Other related posts:

  • » [haiku-commits] r38063 - in haiku/trunk/src/kits: interface support - yourpalal2