[Pkg-kde-bugs-fwd] [Bug 104454] crash when displaying meta info of file being downloaded

David Faure 104454@bugs.kde.org
1 Jun 2005 23:17:08 -0000


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=104454         




------- Additional Comments From faure kde org  2005-06-02 01:17 -------
SVN commit 421006 by dfaure:

Fix crash and use correct mimetype. Rumours say this doesn't completely fix this plugin though.
CCBUG: 104454


 M  +16 -8     kfile_deb.cpp  


--- trunk/KDE/kdeadmin/kfile-plugins/deb/kfile_deb.cpp #421005:421006
 @ -48,7 +48,7  @
     
     : KFilePlugin(parent, name, args)
 {
-    KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-debian-package" );
+    KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-deb" );
     KFileMimeTypeInfo::GroupInfo* group = 0L;
     group = addGroupInfo(info, "General", i18n("General"));
     KFileMimeTypeInfo::ItemInfo* item;
 @ -70,15 +70,23  @
 
     const KArchiveDirectory* debdir = debfile.directory();
     const KArchiveEntry* controlentry = debdir->entry( "control.tar.gz" );
-    Q_ASSERT( controlentry && controlentry->isFile() );
-    
-    KTar tarfile ( KFilterDev::device( static_cast<const KArchiveFile *>(controlentry)->device(), "application/x-gzip" ) );
-    
+    if ( !controlentry || !controlentry->isFile() ) {
+        kdWarning(7034) << "control.tar.gz not found" << endl;
+        return false;
+    }
+
+    QIODevice* filterDev = KFilterDev::device( static_cast<const KArchiveFile *>( controlentry )->device(), "application/x-gzip" );
+    if ( !filterDev ) {
+        kdWarning(7034) << "Couldn't create filter device for control.tar.gz" << endl;
+        return false;
+    }
+    KTar tarfile( filterDev );
+
     if ( !tarfile.open( IO_ReadOnly ) ) {
-        kdDebug(7034) << "Couldn't open control.tar.gz" << endl;
-        return false;    
+        kdWarning(7034) << "Couldn't open control.tar.gz" << endl;
+        return false;
     }
-        
+
     const KArchiveDirectory* controldir = tarfile.directory();
     Q_ASSERT( controldir );