[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: KDE1.1.2: KMail bug
From:       Waldo Bastian <bastian () suse ! de>
Date:       1999-08-05 9:28:22
[Download RAW message or body]

> This is because for some reason the .YourFolder.index kmail files are being
> stored in the current directory instead of in the ~/Mail directory. It has been
> like that for quite some time and I haven't had the time to look into it
> further. 

Nasty one. It is an C++ inheritance/desturction problem.

You have KMFolderRootDir which inherits from KMFolderDir. 
KMFolderRootDir has a virtual method path() which overload the
virtaul method path() in KMFolderDir.

Destruction goes as follows:

~KMFolderRootDir: 
  implicit function, created by compiler, destructs member variables
  like mPath.
~KMFolderDir:
  explicit function calls clear() to delete all member nodes.
...
membernode: 
  calls path() of parent.... vtable redirects us to
  KMFolderRootDir::path() which returns mPath. **OOPS**
  mPath was already deleted.

Solution:
  delete the member nodes already in the destructor of KMFolderRootDir.
  That way path() gives still valid results.

Patch for KDE 1.1.2 is attached. Can someone have a look at it so that
I can commit it?

Cheers,
Waldo

["kdenetwork.kmail.05-08-99.diff" (text/x-c++)]

? kmail/cvs.status
Index: kmail/kmfolderdir.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfolderdir.cpp,v
retrieving revision 1.11.4.2
diff -u -r1.11.4.2 kmfolderdir.cpp
--- kmfolderdir.cpp	1999/05/29 10:21:12	1.11.4.2
+++ kmfolderdir.cpp	1999/08/05 09:30:02
@@ -22,6 +22,15 @@
   setPath(path);
 }
 
+//-----------------------------------------------------------------------------
+KMFolderRootDir::~KMFolderRootDir()
+{
+  // WABA: We can't let KMFolderDir do this because by the time its
+  // desctructor gets called, KMFolderRootDir is already destructed
+  // Most notably the path.
+  clear();
+}
+
 
 //-----------------------------------------------------------------------------
 void KMFolderRootDir::setPath(const char* aPath)
Index: kmail/kmfolderdir.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmfolderdir.h,v
retrieving revision 1.6
diff -u -r1.6 kmfolderdir.h
--- kmfolderdir.h	1997/10/15 21:00:51	1.6
+++ kmfolderdir.h	1999/08/05 09:30:02
@@ -41,6 +41,8 @@
 
 public:
   KMFolderRootDir(const char* name=NULL);
+  virtual ~KMFolderRootDir();
+  
   virtual const QString& path(void) const;
 
   // set the absolute path


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic