[nemiver] Fix critical warnings when closing a file (Closes: #578736)



commit 25cfbfcee46193ec43d64b64bf48380ffd303bf1
Author: Jonathon Jongsma <jonathon jongsma collabora co uk>
Date:   Sun Apr 19 14:57:28 2009 -0500

    Fix critical warnings when closing a file (Closes: #578736)
    
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc: copy the path string out
    	before passing it to close_file() because we will get memory corruption if
    	we pass a reference to the std::map value, since close_file() modifies the
    	map.
---
 src/persp/dbgperspective/nmv-dbg-perspective.cc |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 8991ef6..0f4026a 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -4584,7 +4584,11 @@ DBGPerspective::close_current_file ()
     LOG_FUNCTION_SCOPE_NORMAL_DD;
     if (!get_n_pages ()) {return;}
 
-    close_file (m_priv->pagenum_2_path_map[m_priv->current_page_num]);
+    // We need to copy the path and pass it to close_file() because if we pass
+    // it the reference to the map value, we will get corruption because
+    // close_file() modifies the map
+    UString path = m_priv->pagenum_2_path_map[m_priv->current_page_num];
+    close_file (path);
 }
 
 void



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