Fixes the issue in List count handling which might result
in sigsegv during destruction. Also added additional check
for start button handling.
---
 src/control.cpp  |    3 ++-
 src/phonesim.cpp |   10 +++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 2cbb91a..f2249cb 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -467,7 +467,8 @@ void Control::handleNewApp()
 
 void ControlWidget::simAppStart()
 {
-    p->simAppStart( ui->cbSimApps->currentIndex() );
+    if ( ui->cbSimApps->currentIndex() >= 0 )
+        p->simAppStart( ui->cbSimApps->currentIndex() );
 }
 
 void ControlWidget::simAppAbort()
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 47425bc..8a9c50e 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -844,13 +844,17 @@ void SimRules::tryReadCommand()
 
 void SimRules::destruct()
 {
+    int count = simApps.count();
+
+    for ( int i = 0; i < count; i++ )
+        simApps.removeAt( 0 );
+
     delete conformanceApp;
+    conformanceApp = NULL;
     delete defaultToolkitApp;
+    defaultToolkitApp = NULL;
     toolkitApp = NULL;
 
-    for ( int i = 0; i < simApps.count(); i++ )
-        simApps.removeAt( i );
-
     if ( getMachine() )
         getMachine()->handleNewApp();
 
-- 
1.7.0.4

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to