diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-05-14 19:38:10 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-05-14 19:38:10 -0500 |
commit | 7be7990fc5770d2cbcd937772e8239167b5900c6 (patch) | |
tree | 98b85ad24287d0b4c6780fc6fe2e7bbfdc8e0289 /ark | |
parent | 3df0615503bca377641668fdfabffde9d3f81ddb (diff) | |
download | tdeutils-7be7990fc5770d2cbcd937772e8239167b5900c6.tar.gz tdeutils-7be7990fc5770d2cbcd937772e8239167b5900c6.zip |
Properly initialize worker thread
This relates to Bug 1404
Diffstat (limited to 'ark')
-rw-r--r-- | ark/tarlistingthread.cpp | 16 | ||||
-rw-r--r-- | ark/tarlistingthread.h | 3 |
2 files changed, 12 insertions, 7 deletions
diff --git a/ark/tarlistingthread.cpp b/ark/tarlistingthread.cpp index 83154c4..9d903c3 100644 --- a/ark/tarlistingthread.cpp +++ b/ark/tarlistingthread.cpp @@ -79,29 +79,33 @@ static char *makeAccessString(mode_t mode) } TarListingThread::TarListingThread( TQObject *parent, const TQString& filename ) - : TQThread(), m_parent( parent ) + : TQThread(), m_parent( parent ), m_archive(NULL) { Q_ASSERT( m_parent ); - m_archive = new KTar( filename ); + m_archiveFileName = filename; } TarListingThread::~TarListingThread() { - delete m_archive; - m_archive = 0; + if (m_archive) { + delete m_archive; + m_archive = 0; + } } void TarListingThread::run() { + m_archive = new KTar( m_archiveFileName ); + if (!m_archive->open( IO_ReadOnly )) { ListingEvent *ev = new ListingEvent( TQStringList(), ListingEvent::Error ); tqApp->postEvent( m_parent, ev ); return; } - + processDir( m_archive->directory(), TQString() ); - + // Send an empty TQStringList in an Event to signal the listing end. ListingEvent *ev = new ListingEvent( TQStringList(), ListingEvent::ListingFinished ); tqApp->postEvent( m_parent, ev ); diff --git a/ark/tarlistingthread.h b/ark/tarlistingthread.h index 070b483..ab675f1 100644 --- a/ark/tarlistingthread.h +++ b/ark/tarlistingthread.h @@ -55,7 +55,8 @@ class TarListingThread: public TQThread private: void processDir( const KTarDirectory *tardir, const TQString & root ); - + + TQString m_archiveFileName; KArchive *m_archive; TQObject *m_parent; }; |