nemiver r947 - in trunk: . src



Author: dodji
Date: Sat Nov 22 20:46:17 2008
New Revision: 947
URL: http://svn.gnome.org/viewvc/nemiver?rev=947&view=rev

Log:
Fix 561287 - crash when doing nemiver --purgesessions.

	* src/main.cc (process_command_line_non_gui): Rename this function into ...
	  (process_non_gui_command_line): This one.
	  (process_command_line): Rename this function into ...
	  (process_gui_command_line): This one. Also, move the handling
	  of the session purging from process_non_gui_command_line
	  to here as this requires the workbench, debugging perspective
	  and so the GUI. Yes that sucks. The session handling
	  code should be moved outside of the perspective, but that's another
	  story. For now, all we know is that we need the workbench to be
	  created, if we want to be able to purge the sessions.
	  session purging. This entry should fix the crash reported at
	  #561287.

Modified:
   trunk/ChangeLog
   trunk/src/main.cc

Modified: trunk/src/main.cc
==============================================================================
--- trunk/src/main.cc	(original)
+++ trunk/src/main.cc	Sat Nov 22 20:46:17 2008
@@ -221,7 +221,7 @@
 }
 
 static bool
-process_command_line_non_gui (int&, char**, int &a_return)
+process_non_gui_command_line (int&, char**, int &a_return)
 {
     if (gv_log_debugger_output) {
         LOG_STREAM.enable_domain ("gdbmi-output-domain");
@@ -242,6 +242,13 @@
         }
     }
 
+    a_return = 0;
+    return true;
+}
+
+static bool
+process_gui_command_line (int& a_argc, char** a_argv, int &a_return)
+{
     if (gv_purge_sessions) {
         IDBGPerspective *debug_persp =
             dynamic_cast<IDBGPerspective*> (s_workbench->get_perspective
@@ -252,13 +259,6 @@
         a_return = 0;
         return false;
     }
-    a_return = 0;
-    return true;
-}
-
-static bool
-process_command_line (int& a_argc, char** a_argv, int &a_return)
-{
 
     if (gv_process_to_attach_to) {
         using nemiver::common::IProcMgrSafePtr;
@@ -460,25 +460,27 @@
     parse_command_line (a_argc, a_argv);
 
     int retval;
-    if (process_command_line_non_gui (a_argc, a_argv, retval) != true) {
+    if (process_non_gui_command_line (a_argc, a_argv, retval) != true) {
         return -1;
     }
 
 
-    //**********************************
-    //load the workbench dynamic module
-    //**********************************
+    //********************************************
+    //load and init the workbench dynamic module
+    //********************************************
     DynamicModuleManager module_manager;
     IWorkbenchSafePtr workbench =
         module_manager.load_iface<IWorkbench> ("workbench", "IWorkbench");
     s_workbench = workbench.get ();
+    THROW_IF_FAIL (s_workbench);
     LOG_D ("workbench refcount: " <<  (int) s_workbench->get_refcount (),
-            "refcount-domain");
+           "refcount-domain");
+
     s_workbench->do_init (gtk_kit);
     LOG_D ("workbench refcount: " <<  (int) s_workbench->get_refcount (),
            "refcount-domain");
 
-    if (process_command_line (a_argc, a_argv, retval) != true) {
+    if (process_gui_command_line (a_argc, a_argv, retval) != true) {
         return -1;
     }
 



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