--- a/browserutilities/downloadmgr/DownloadMgrServEng/Src/BuffStorage.cpp Tue Aug 31 16:17:46 2010 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrServEng/Src/BuffStorage.cpp Wed Sep 01 12:28:30 2010 +0100
@@ -28,9 +28,9 @@
#include "HttpDownloadMgrLogger.h"
#include "HeaderField.h"
-#include <sysutil.h>
+#include <SysUtil.h>
#include <DocumentHandler.h>
-#include <apmstd.h>
+#include <APMSTD.H>
#include "HttpDownloadMgrLogger.h"
@@ -79,6 +79,7 @@
{
LOGGER_ENTERFN( "ConstructL" );
CActiveScheduler::Add( this );
+ iWait = new (ELeave) CActiveSchedulerWait;
}
// -----------------------------------------------------------------------------
@@ -108,6 +109,11 @@
ResetBuffers();
delete iWritePtr; iWritePtr = 0;
+ if(iWait)
+ {
+ delete iWait;
+ iWait = NULL;
+ }
}
@@ -134,10 +140,10 @@
CLOG_WRITE_2( "(%08X) CBuffStorage::RunL DH-iStat: %d, ", this, iStatus.Int() );
}
- if(iWait.IsStarted())
+ if(iWait && iWait->IsStarted())
{
CLOG_WRITE_1 ( "(%08X) CBuffStorage::RunL() Stopping iWait", this );
- iWait.AsyncStop();
+ iWait->AsyncStop();
}
}
@@ -157,10 +163,10 @@
{
CLOG_WRITE_1("(%08X) CBuffStorage::ResetBuffers >>", this);
- if(IsActive())
+ if(IsActive()&& iWait && !iWait->IsStarted())
{
// Make sure async writes are finished
- iWait.Start();
+ iWait->Start();
}
// Cleanup
@@ -225,10 +231,10 @@
CLOG_WRITE_1("(%08X) CBuffStorage::FlushBuffersL >>", this);
// Make sure async writes are finished before doing anything
- if(IsActive())
+ if(IsActive() && iWait && !iWait->IsStarted())
{
CLOG_WRITE_1("(%08X) CBuffStorage::FlushBuffersL: stalling >>", this);
- iWait.Start();
+ iWait->Start();
CLOG_WRITE_1("(%08X) CBuffStorage::FlushBuffersL: stalling <<", this);
}
@@ -335,10 +341,10 @@
// Check if previous async write is still ongoing
// Done here so if somebody switched on progressive download midway through we don't mix buffers
- if(IsActive())
+ if(IsActive()&& iWait && !iWait->IsStarted())
{
CLOG_WRITE_1("(%08X) CBuffStorage::DoBufferingWriteL: stalling >>", this);
- iWait.Start();
+ iWait->Start();
CLOG_WRITE_1("(%08X) CBuffStorage::DoBufferingWriteL: stalling <<", this);
}
@@ -415,10 +421,10 @@
{
CLOG_WRITE_2("(%08X) CBuffStorage::DoNonbufferingWriteL: %d bytes", this, aBuf.Length());
- if(IsActive())
+ if(IsActive() && iWait && !iWait->IsStarted())
{
CLOG_WRITE_1("(%08X) CBuffStorage::DoNonbufferingWriteL: stalling >>", this);
- iWait.Start();
+ iWait->Start();
CLOG_WRITE_1("(%08X) CBuffStorage::DoNonbufferingWriteL: stalling <<", this);
}