maybe this could be a compromise

Roland Krause rokrau at yahoo.com
Fri Mar 30 18:45:52 UTC 2001


Ok, here is a tiny patch that prevents the "no current view" related
crashes. There is a debug message that will remind us to correct the
actual problem, that is to make the menu unavailable.

Roland


Index: ckdevelop.cpp
===================================================================
RCS file: /home/kde/kdevelop/kdevelop/Attic/ckdevelop.cpp,v
retrieving revision 1.158.2.114.2.73
diff -u -r1.158.2.114.2.73 ckdevelop.cpp
--- ckdevelop.cpp	2001/03/29 22:29:34	1.158.2.114.2.73
+++ ckdevelop.cpp	2001/03/30 18:42:41
@@ -176,8 +176,14 @@
 void CKDevelop::slotFileClose()
 {
   debug("CKDevelop::slotFileClose !\n");
-  slotStatusMsg(i18n("Closing file..."));
+
+  if (!m_docViewManager->currentEditView()) {
+    debug("menu option should be disabled so this message can go
away\n");
+    slotStatusMsg(i18n("no file to close"));
+    return;
+  }    
   QString filename = m_docViewManager->currentEditView()->getName();
+  slotStatusMsg(i18n("Closing file..."));
   int message_result;
 
   debug("Test modified !\n");
@@ -225,11 +231,16 @@
 
 void CKDevelop::slotFileSave(){
 
+  if (!m_docViewManager->currentEditView()) {
+    slotStatusMsg(i18n("no file to save"));
+    debug("menu option should be disabled so this message can go
away\n");
+    return;
+  }
   QString filename=m_docViewManager->currentEditView()->getName();
   QString sShownFilename=QFileInfo(filename).fileName();
   slotStatusMsg(i18n("Saving file %1").arg(sShownFilename));
   
-   if(isUntitled(filename)){
+  if(isUntitled(filename)){
     slotFileSaveAs();
   } else {
     m_docViewManager->doFileSave(project);
@@ -273,13 +284,19 @@
     {
       setMainCaption();
       debug("currentEditView is Header or Source ! \n");
-      activateView( (QextMdiChildView*)
m_docViewManager->currentEditView()->parentWidget());
+      if (m_docViewManager->currentEditView()) {
+        debug("menu option should be disabled so this message can go
away\n");
+        activateView( (QextMdiChildView*)
m_docViewManager->currentEditView()->parentWidget());
+      }
     }
   else 
     {
       setMainCaption(BROWSER);
       debug("currentDocType is HTML ! \n");
-      activateView( (QextMdiChildView*)
m_docViewManager->currentBrowserView()->parentWidget());
+      if (m_docViewManager->currentBrowserView()) {
+        debug("menu option should be disabled so this message can go
away\n");
+        activateView( (QextMdiChildView*)
m_docViewManager->currentBrowserView()->parentWidget());
+      }
     }
 
   debug("slotStatusMsg ! \n");
@@ -293,6 +310,11 @@
 void CKDevelop::slotFilePrint(){
   QString file;
   slotFileSave();
+  if (!m_docViewManager->currentEditView()) {
+    slotStatusMsg(i18n("no file to save"));
+    debug("menu option should be disabled so this message can go
away\n");
+    return;
+  }
   file = m_docViewManager->currentEditView()->getName();
   CPrintDlg* printerdlg = new CPrintDlg(this, file, "suzus");
   printerdlg->resize(600,480);


=====
--
Roland Krause
In the garage of life there are mechanics and 
there are drivers. Mechanics wanted!

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

-
to unsubscribe from this list send an email to kdevelop-devel-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop-devel mailing list