Properly initialize worker thread

This relates to Bug 1404
pull/1/head
Timothy Pearson 11 years ago
parent 3df0615503
commit 7be7990fc5

@ -79,20 +79,24 @@ static char *makeAccessString(mode_t mode)
} }
TarListingThread::TarListingThread( TQObject *parent, const TQString& filename ) TarListingThread::TarListingThread( TQObject *parent, const TQString& filename )
: TQThread(), m_parent( parent ) : TQThread(), m_parent( parent ), m_archive(NULL)
{ {
Q_ASSERT( m_parent ); Q_ASSERT( m_parent );
m_archive = new KTar( filename ); m_archiveFileName = filename;
} }
TarListingThread::~TarListingThread() TarListingThread::~TarListingThread()
{ {
if (m_archive) {
delete m_archive; delete m_archive;
m_archive = 0; m_archive = 0;
} }
}
void TarListingThread::run() void TarListingThread::run()
{ {
m_archive = new KTar( m_archiveFileName );
if (!m_archive->open( IO_ReadOnly )) if (!m_archive->open( IO_ReadOnly ))
{ {
ListingEvent *ev = new ListingEvent( TQStringList(), ListingEvent::Error ); ListingEvent *ev = new ListingEvent( TQStringList(), ListingEvent::Error );

@ -56,6 +56,7 @@ class TarListingThread: public TQThread
private: private:
void processDir( const KTarDirectory *tardir, const TQString & root ); void processDir( const KTarDirectory *tardir, const TQString & root );
TQString m_archiveFileName;
KArchive *m_archive; KArchive *m_archive;
TQObject *m_parent; TQObject *m_parent;
}; };

Loading…
Cancel
Save