[haiku-commits] haiku: hrev45691 - in src/apps: debuganalyzer/gui/table debugger/user_interface/gui/team_window

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 16 May 2013 02:18:35 +0200 (CEST)

hrev45691 adds 3 changesets to branch 'master'
old head: 01636e8f2af4878e9181ff1a18721494e5222e75
new head: 66b86c6aeec08f25c9dc5572093ef96effabcce6
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=66b86c6+%5E01636e8

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

1d897b8: Remove NotifyNodesCleared() again.
  
  - For various reasons this one can be error prone, since it relies on
  the model being able to provide the correct row count, which won't be
  the case if the subclass calls it after having already removed all its
  nodes.
  
  - Optimize Table's RowsRemoved() similarly to TreeTable's for the remove
  all rows case.

5d8c967: VariablesView: Switch back to NotifyNodesRemoved().

66b86c6: ImageFunctionsView: Switch back to NotifyNodesRemoved().

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

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

6 files changed, 11 insertions(+), 29 deletions(-)
src/apps/debuganalyzer/gui/table/Table.cpp          | 17 ++++++-----------
src/apps/debuganalyzer/gui/table/Table.h            |  1 -
src/apps/debuganalyzer/gui/table/TreeTable.cpp      | 12 ------------
src/apps/debuganalyzer/gui/table/TreeTable.h        |  1 -
.../gui/team_window/ImageFunctionsView.cpp          |  5 +++--
.../gui/team_window/VariablesView.cpp               |  4 ++--

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

Commit:      1d897b8a54ff6be1804751a6fc1d48b124475524
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1d897b8
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Thu May 16 00:12:28 2013 UTC

Remove NotifyNodesCleared() again.

- For various reasons this one can be error prone, since it relies on
the model being able to provide the correct row count, which won't be
the case if the subclass calls it after having already removed all its
nodes.

- Optimize Table's RowsRemoved() similarly to TreeTable's for the remove
all rows case.

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

diff --git a/src/apps/debuganalyzer/gui/table/Table.cpp 
b/src/apps/debuganalyzer/gui/table/Table.cpp
index 36d3122..2eb7b93 100644
--- a/src/apps/debuganalyzer/gui/table/Table.cpp
+++ b/src/apps/debuganalyzer/gui/table/Table.cpp
@@ -125,17 +125,6 @@ TableModel::NotifyRowsChanged(int32 rowIndex, int32 count)
 
 
 void
-TableModel::NotifyRowsCleared()
-{
-       int32 listenerCount = fListeners.CountItems();
-       for (int32 i = listenerCount - 1; i >= 0; i--) {
-               TableModelListener* listener = fListeners.ItemAt(i);
-               listener->TableRowsRemoved(this, 0, CountRows());
-       }
-}
-
-
-void
 TableModel::NotifyTableModelReset()
 {
        int32 listenerCount = fListeners.CountItems();
@@ -644,6 +633,12 @@ Table::TableRowsAdded(TableModel* model, int32 rowIndex, 
int32 count)
 void
 Table::TableRowsRemoved(TableModel* model, int32 rowIndex, int32 count)
 {
+       if (rowIndex == 0 && count == fRows.CountItems()) {
+               fRows.MakeEmpty();
+               Clear();
+               return;
+       }
+
        for (int32 i = rowIndex + count - 1; i >= rowIndex; i--) {
                if (BRow* row = fRows.RemoveItemAt(i)) {
                        RemoveRow(row);
diff --git a/src/apps/debuganalyzer/gui/table/Table.h 
b/src/apps/debuganalyzer/gui/table/Table.h
index da45b3f..99abf68 100644
--- a/src/apps/debuganalyzer/gui/table/Table.h
+++ b/src/apps/debuganalyzer/gui/table/Table.h
@@ -52,7 +52,6 @@ protected:
                        void                            NotifyRowsAdded(int32 
rowIndex, int32 count);
                        void                            NotifyRowsRemoved(int32 
rowIndex, int32 count);
                        void                            NotifyRowsChanged(int32 
rowIndex, int32 count);
-                       void                            NotifyRowsCleared();
                        void                            NotifyTableModelReset();
 
 protected:
diff --git a/src/apps/debuganalyzer/gui/table/TreeTable.cpp 
b/src/apps/debuganalyzer/gui/table/TreeTable.cpp
index bcef139..c69149e 100644
--- a/src/apps/debuganalyzer/gui/table/TreeTable.cpp
+++ b/src/apps/debuganalyzer/gui/table/TreeTable.cpp
@@ -234,18 +234,6 @@ TreeTableModel::NotifyNodesChanged(const TreeTablePath& 
path, int32 childIndex,
 
 
 void
-TreeTableModel::NotifyNodesCleared()
-{
-       int32 listenerCount = fListeners.CountItems();
-       for (int32 i = listenerCount - 1; i >= 0; i--) {
-               TreeTableModelListener* listener = fListeners.ItemAt(i);
-               listener->TableNodesRemoved(this, TreeTablePath(), 0,
-                       CountChildren(Root()));
-       }
-}
-
-
-void
 TreeTableModel::NotifyTableModelReset()
 {
        int32 listenerCount = fListeners.CountItems();
diff --git a/src/apps/debuganalyzer/gui/table/TreeTable.h 
b/src/apps/debuganalyzer/gui/table/TreeTable.h
index 138d4cf..81d8924 100644
--- a/src/apps/debuganalyzer/gui/table/TreeTable.h
+++ b/src/apps/debuganalyzer/gui/table/TreeTable.h
@@ -94,7 +94,6 @@ protected:
                                                                        int32 
childIndex, int32 count);
                        void                            
NotifyNodesChanged(const TreeTablePath& path,
                                                                        int32 
childIndex, int32 count);
-                       void                            NotifyNodesCleared();
                        void                            NotifyTableModelReset();
 
 protected:

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

Commit:      5d8c967faccd81b7645f67dab943d7a02a29beb4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5d8c967
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Thu May 16 00:14:34 2013 UTC

VariablesView: Switch back to NotifyNodesRemoved().

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

diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp 
b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp
index 7c84b58..913f802 100644
--- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp
+++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp
@@ -928,17 +928,17 @@ VariablesView::VariableTableModel::SetStackFrame(Thread* 
thread,
 
        fNodeManager->SetStackFrame(thread, stackFrame);
 
+       int32 count = fNodes.CountItems();
        fNodeTable.Clear(true);
 
        if (!fNodes.IsEmpty()) {
-               int32 count = fNodes.CountItems();
                for (int32 i = 0; i < count; i++)
                        fNodes.ItemAt(i)->ReleaseReference();
                fNodes.MakeEmpty();
        }
 
        if (stackFrame == NULL) {
-               NotifyNodesCleared();
+               NotifyNodesRemoved(TreeTablePath(), 0, count);
                return;
        }
 

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

Revision:    hrev45691
Commit:      66b86c6aeec08f25c9dc5572093ef96effabcce6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=66b86c6
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Thu May 16 00:15:51 2013 UTC

ImageFunctionsView: Switch back to NotifyNodesRemoved().

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

diff --git 
a/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp 
b/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp
index c1b6061..281e2ec 100644
--- a/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp
+++ b/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp
@@ -169,8 +169,9 @@ public:
        void SetImageDebugInfo(ImageDebugInfo* imageDebugInfo)
        {
                // unset old functions
+               int32 count = fChildPathComponents.CountItems();
                if (fImageDebugInfo != NULL) {
-                       for (int32 i = 0; i < 
fChildPathComponents.CountItems(); i++)
+                       for (int32 i = 0; i < count; i++)
                                
fChildPathComponents.ItemAt(i)->ReleaseReference();
 
                        fChildPathComponents.MakeEmpty();
@@ -182,7 +183,7 @@ public:
                // set new functions
                if (fImageDebugInfo == NULL || fImageDebugInfo->CountFunctions()
                                == 0) {
-                       NotifyNodesCleared();
+                       NotifyNodesRemoved(TreeTablePath(), 0, count);
                        return;
                }
 


Other related posts:

  • » [haiku-commits] haiku: hrev45691 - in src/apps: debuganalyzer/gui/table debugger/user_interface/gui/team_window - anevilyak