[PATCH 3/3] Fix offscreen -> onscreen locals rendering



Hello,

First, let me describe the principle of a really simple speed
optimization in Nemiver.

To reduce the number of commands round trip between Nemiver and its
GDB backend, we implemented a kind of lazy command sending scheme.
That is, if for instance the local variables widget is not visible, no
command to get information about local variables will be issued to
GDB.  But when the widget becomes visible, it queries the backend for
all the necessary state to graphically update itself.

I recently realized that lazy querying was broken for the local
variables view, on master.

The patch below addresses that issue, has been tested and is being
applied to master.

	* src/persp/dbgperspective/nmv-local-vars-inspector.cc
	(is_local_variables_subtree_empty, inspector_is_empty): New
	functions.
	(finish_handling_debugger_stopped_event): Add logging.  Use the
	new inspector_is_empty.  Make sure to save proper state in all
	cases.
---
 .../dbgperspective/nmv-local-vars-inspector.cc     |   28 +++++++++++++++++---
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/persp/dbgperspective/nmv-local-vars-inspector.cc b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
index e1c222c..bc124ba 100644
--- a/src/persp/dbgperspective/nmv-local-vars-inspector.cc
+++ b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
@@ -173,7 +173,25 @@ public:
     }
 
     bool
-    get_local_variables_row_iterator (Gtk::TreeModel::iterator &a_it)
+    is_local_variables_subtree_empty () const
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+        Gtk::TreeModel::iterator it;
+        if (!get_local_variables_row_iterator (it))
+            return true;
+        return it->children ().empty ();
+    }
+
+    bool
+    inspector_is_empty () const
+    {
+        return (is_function_arguments_subtree_empty ()
+                && is_local_variables_subtree_empty ());
+    }
+
+    bool
+    get_local_variables_row_iterator (Gtk::TreeModel::iterator &a_it) const
     {
         if (!local_variables_row_ref) {
             LOG_DD ("there is no variables row iter yet");
@@ -487,12 +505,14 @@ public:
 
         THROW_IF_FAIL (tree_store);
 
+        LOG_DD ("a_has_frame: " << a_has_frame);
+
         if (!a_has_frame)
             return;
 
         saved_frame = a_frame;
 
-        if (is_new_frame) {
+        if (is_new_frame || inspector_is_empty ()) {
             LOG_DD ("init tree view");
             re_init_tree_view ();
             LOG_DD ("list local variables");
@@ -708,14 +728,14 @@ public:
         THROW_IF_FAIL (debugger);
         is_new_frame = (saved_frame != a_frame);
         saved_frame = a_frame;
+        saved_reason = a_reason;
+        saved_has_frame = a_has_frame;
 
         if (should_process_now ()) {
             finish_handling_debugger_stopped_event (a_reason,
                                                     a_has_frame,
                                                     a_frame);
         } else {
-            saved_reason = a_reason;
-            saved_has_frame = a_has_frame;
             is_up2date = false;
         }
 
-- 
1.7.6.4



-- 
		Dodji


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]