summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-10-15 11:27:26 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-10-15 11:27:26 (GMT)
commit13bc1e0b99dd1d32bc0fef1dbdf0813ff5f4c66c (patch)
treefa3ae3e8dc19dfdea28df2596319dd1513e554b0 /util
parentcc6bc2c286d2638f428f4d25f7eac00875578d3f (diff)
downloadQt-13bc1e0b99dd1d32bc0fef1dbdf0813ff5f4c66c.zip
Qt-13bc1e0b99dd1d32bc0fef1dbdf0813ff5f4c66c.tar.gz
Qt-13bc1e0b99dd1d32bc0fef1dbdf0813ff5f4c66c.tar.bz2
Make s60pixelmetrics harvester utility app more robust
There were some exceptional situations where the utility app caused either a memory leak, or outright crashed. Reviewed-by: TrustMe
Diffstat (limited to 'util')
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp
index a88499d..d68a0b0 100644
--- a/util/s60pixelmetrics/pm_mapperapp.cpp
+++ b/util/s60pixelmetrics/pm_mapperapp.cpp
@@ -166,6 +166,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
else
bufferPtr.Append(_L("screen."));
ShowL( *buffer, last );
+ CleanupStack::PopAndDestroy( buffer );
}
break;
case ECmdStatus:
@@ -257,7 +258,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
bufferPtr.Append(_L("Orientation cannot be changed."));
ShowL( *buffer, last );
bufferPtr.Zero();
- delete buffer;
+ CleanupStack::PopAndDestroy( buffer );
break;
}
#endif //__SERIES60_31__
@@ -278,7 +279,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
bufferPtr.Append(_L("Orientation changed."));
ShowL( *buffer, last );
bufferPtr.Zero();
- delete buffer;
+ CleanupStack::PopAndDestroy( buffer );
break;
}
case ECmdStartCalculations:
@@ -787,11 +788,14 @@ void CPixelMetricsMapperAppUi::CreateHeaderFileL() const
CleanupStack::PopAndDestroy(); //sourceFile
}
- bufferLayoutHdr = bufferLayoutHdr.Left(bufferLayoutHdr.Length()-2);
- bufferPMData = bufferPMData.Left(bufferPMData.Length()-2);
- textFile.Write(bufferLayoutHdr);
- textFile.Write(KCRLF);
- textFile.Write(bufferPMData);
+ if (fileCount > 0)
+ {
+ bufferLayoutHdr = bufferLayoutHdr.Left(bufferLayoutHdr.Length()-2);
+ bufferPMData = bufferPMData.Left(bufferPMData.Length()-2);
+ textFile.Write(bufferLayoutHdr);
+ textFile.Write(KCRLF);
+ textFile.Write(bufferPMData);
+ }
delete dirList;
CleanupStack::PopAndDestroy(); //file