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

List:       kde-commits
Subject:    koffice/lib/store
From:       Raphael Langerhorst <raphael-langerhorst () gmx ! at>
Date:       2005-03-30 20:23:06
Message-ID: 20050330202306.DF2E9632 () office ! kde ! org
[Download RAW message or body]

CVS commit by raphael: 

Prevent KOffice from crashing when saving in a read-only directory.

This worked up to KDE 3.3.2, in KDE 3.4 it crashes.

I assume this is a bug in KIO (but can't tell for sure, should be
investigated if possible). This workaround also creates a potential
memory leakage (I guess. Again, I didn't look into KIO for the details).


  M +18 -4     koZipStore.cc   1.19


--- koffice/lib/store/koZipStore.cc  #1.18:1.19
@@ -35,4 +35,7 @@ KoZipStore::KoZipStore( const QString & 
 
     m_pZip = new KZip( _filename );
+    if (!m_pZip)
+      m_bGood = false;
+    else
     m_bGood = init( _mode, appIdentification ); // open the zip file and init some vars
 }
@@ -41,4 +44,7 @@ KoZipStore::KoZipStore( QIODevice *dev, 
 {
     m_pZip = new KZip( dev );
+    if (!m_pZip)
+      m_bGood = false;
+    else
     m_bGood = init( mode, appIdentification );
 }
@@ -67,4 +73,7 @@ KoZipStore::KoZipStore( QWidget* window,
 
     m_pZip = new KZip( m_localFileName );
+    if (!m_pZip)
+      m_bGood = false;
+    else
     m_bGood = init( _mode, appIdentification ); // open the zip file and init some vars
 }
@@ -74,5 +83,10 @@ KoZipStore::~KoZipStore()
     kdDebug(s_area) << "KoZipStore::~KoZipStore" << endl;
     m_pZip->close();
-    delete m_pZip;
+    
+    Q_CHECK_PTR(m_pZip);
+
+    //TODO THIS is very likely a memory leak, but it causes a crash inside kdelibs (KIO)
+//     if (m_pZip)
+//       delete m_pZip;
 
     // Now we have still some job to do for remote files.


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

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