summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-12-06 18:35:49 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-12-06 19:36:24 +0900
commitbbdc5984a2d4166bff5ab24e7ec406d1a5b06e83 (patch)
tree155047102f7839d940d178a8648b112cd8736a9c /src
parentc0effe456c6b43661f43d251c7923ebf3b953cba (diff)
downloadkstreamripper-bbdc5984a2d4166bff5ab24e7ec406d1a5b06e83.tar.gz
kstreamripper-bbdc5984a2d4166bff5ab24e7ec406d1a5b06e83.zip
Fix deallocation of process controllers when quitting the application
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src')
-rw-r--r--src/kstreamripper.cpp38
-rw-r--r--src/processcontroller.cpp2
2 files changed, 19 insertions, 21 deletions
diff --git a/src/kstreamripper.cpp b/src/kstreamripper.cpp
index 2abd249..9630c8f 100644
--- a/src/kstreamripper.cpp
+++ b/src/kstreamripper.cpp
@@ -127,38 +127,36 @@ KStreamRipper::~KStreamRipper()
void KStreamRipper::closeEvent( TQCloseEvent *e )
{
TDEConfig *appConfig = TDEGlobal::config();
-
+
appConfig->writeEntry( "Destination", m_destEdit->text());
appConfig->writeEntry( "Riptime", m_timeEdit->text());
appConfig->writeEntry( "Command", m_tuneInEdit->text());
appConfig->writeEntry( "Id3Tag", m_id3Checkbox->isChecked());
-
+
//save the listview entrys
-
TQStringList nameList,urlList,descList;
- TQListViewItemIterator iter( m_streamsListView );
-
- while( iter.current() )
- {
- ProcessListViewItem * ProcItem = (ProcessListViewItem*)iter.current();
- if(ProcItem->getProcessController()->getAutomatic()) continue;
-
- nameList.append( iter.current()->text( 0 ));
- urlList.append( ProcItem->getProcessController()->getUrl() );
- descList.append( ProcItem->getProcessController()->getDescription() );
- if ( ProcItem->getProcessController()->getStatus() )
+ while( m_streamsListView->childCount() > 0)
+ {
+ ProcessListViewItem * procItem = (ProcessListViewItem*)m_streamsListView->firstChild();
+ if (!procItem->getProcessController()->getAutomatic())
+ {
+ nameList.append( procItem->text( 0 ));
+ urlList.append( procItem->getProcessController()->getUrl() );
+ descList.append( procItem->getProcessController()->getDescription() );
+ if ( procItem->getProcessController()->getStatus() )
{
- ProcItem->getProcessController()->stopRip();
+ procItem->getProcessController()->stopRip();
}
- ++iter;
- }
-
+ }
+ delete procItem;
+ }
+
appConfig->writeEntry( "names", nameList );
appConfig->writeEntry( "urls" , urlList );
appConfig->writeEntry( "descs", descList );
-
+
appConfig->sync();
-
+
e->accept();
}
diff --git a/src/processcontroller.cpp b/src/processcontroller.cpp
index 35558b2..a065ed6 100644
--- a/src/processcontroller.cpp
+++ b/src/processcontroller.cpp
@@ -23,7 +23,7 @@
#include "processlistviewitem.h"
ProcessController::ProcessController(ProcessListViewItem * parent)
- : TQObject((TQObject *)parent), myParent(parent), myStatus(false), myAutomatic(false), myProcess(new TQProcess(this))
+ : TQObject(parent), myParent(parent), myStatus(false), myAutomatic(false), myProcess(new TQProcess(this))
{
connect (myProcess, TQT_SIGNAL( readyReadStdout() ), (ProcessController *) this, TQT_SLOT( readStdout()) );
connect (myProcess, TQT_SIGNAL(processExited() ), (ProcessController *) this, TQT_SLOT( processExited()) );