[haiku-commits] haiku: hrev44607 - src/kits/tracker

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 3 Sep 2012 22:43:05 +0200 (CEST)

hrev44607 adds 1 changeset to branch 'master'
old head: 9335e141bac58250fcd93e621eff88206614c754
new head: 139ee879031c4cfc9fcf3434f2d577402a91ad4c

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

139ee87: Fix some behavioral regressions introduced by previous commit.
  
  - Some parts of Tracker were basing certain assumptions on whether the
    types list was NULL or not. We now check on list emptiness instead.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

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

Revision:    hrev44607
Commit:      139ee879031c4cfc9fcf3434f2d577402a91ad4c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=139ee87
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Mon Sep  3 20:42:14 2012 UTC

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

2 files changed, 13 insertions(+), 15 deletions(-)
src/kits/tracker/Model.cpp   |   14 ++++++++------
src/kits/tracker/NavMenu.cpp |   14 +++++---------

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

diff --git a/src/kits/tracker/Model.cpp b/src/kits/tracker/Model.cpp
index 1cf77c8..e4607ad 100644
--- a/src/kits/tracker/Model.cpp
+++ b/src/kits/tracker/Model.cpp
@@ -1109,12 +1109,14 @@ Model::SupportsMimeType(const char* type, const 
BObjectList<BString>* list,
                if (type) {
                        BString typeString(type);
                        match = MatchMimeTypeString(&typeString, mimeSignature);
-               } else
-                       match = 
WhileEachListItem(const_cast<BObjectList<BString>*>(list),
-                               MatchMimeTypeString, mimeSignature);
-                               // const_cast shouldnt be here, have to have it 
until
-                               // MW cleans up
-
+               } else {
+                       if (list != NULL && !list->IsEmpty()) {
+                               match = 
WhileEachListItem(const_cast<BObjectList<BString>*>(list),
+                                       MatchMimeTypeString, mimeSignature);
+                       }
+                       // const_cast shouldnt be here, have to have it until
+                       // MW cleans up
+               }
                if (match == kMatch)
                        // supports the actual type, it can't get any better
                        return kModelSupportsType;
diff --git a/src/kits/tracker/NavMenu.cpp b/src/kits/tracker/NavMenu.cpp
index 4dc6177..14578f5 100644
--- a/src/kits/tracker/NavMenu.cpp
+++ b/src/kits/tracker/NavMenu.cpp
@@ -130,7 +130,7 @@ void
 SpringLoadedFolderSetMenuStates(const BMenu* menu,
        const BObjectList<BString>* typeslist)
 {
-       if (!menu || !typeslist)
+       if (!menu || !typeslist || typeslist->IsEmpty())
                return;
 
        //      if a types list exists
@@ -339,13 +339,6 @@ BNavMenu::AttachedToWindow()
 void
 BNavMenu::DetachedFromWindow()
 {
-       //      does this need to set this to null?
-       //      the parent, handling dnd should set this
-       //      appropriately
-       //
-       //      if this changes, BeMenu and RecentsMenu
-       //      in Deskbar should also change
-       fTypesList = NULL;
 }
 
 
@@ -819,7 +812,10 @@ BNavMenu::SetShowParent(bool show)
 void
 BNavMenu::SetTypesList(const BObjectList<BString>* list)
 {
-       *fTypesList = *list;
+       if (list != NULL)
+               *fTypesList = *list;
+       else
+               fTypesList->MakeEmpty();
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev44607 - src/kits/tracker - anevilyak