diff options
author | Sami Merila <sami.merila@nokia.com> | 2010-10-15 11:27:26 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2010-10-15 11:27:26 (GMT) |
commit | 13bc1e0b99dd1d32bc0fef1dbdf0813ff5f4c66c (patch) | |
tree | fa3ae3e8dc19dfdea28df2596319dd1513e554b0 /util/s60pixelmetrics | |
parent | cc6bc2c286d2638f428f4d25f7eac00875578d3f (diff) | |
download | Qt-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/s60pixelmetrics')
-rw-r--r-- | util/s60pixelmetrics/pm_mapperapp.cpp | 18 |
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 |