Permalink
Browse files

[Loader] loadBytes was broken because of too narrow bytes_buf scope

  • Loading branch information...
1 parent 6b32205 commit ea0265626a9100b2c7457081194e2758d1eb00ee @aajanki aajanki committed Feb 28, 2013
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/scripting/flash/display/flashdisplay.cpp
@@ -317,21 +317,28 @@ void LoaderThread::execute()
loaderInfo->setBytesTotal(bytes->getLength());
loaderInfo->setBytesLoaded(bytes->getLength());
- bytes_buf bb(bytes->bytes,bytes->getLength());
- sbuf=&bb;
+ sbuf = new bytes_buf(bytes->bytes,bytes->getLength());
}
istream s(sbuf);
ParseThread local_pt(s,loaderInfo->applicationDomain,loaderInfo->securityDomain,loader.getPtr(),url.getParsedURL());
local_pt.execute();
- {
+ // Delete the bytes container (downloader or bytes_buf)
+ if (source==URL) {
//Acquire the lock to ensure consistency in threadAbort
SpinlockLocker l(downloaderLock);
if(downloader)
getSys()->downloadManager->destroy(downloader);
downloader=NULL;
+ sbuf = NULL;
+ }
+ else if (source==BYTES)
+ {
+ delete sbuf;
+ sbuf = NULL;
}
+
bytes.reset();
_NR<DisplayObject> obj=local_pt.getParsedObject();

0 comments on commit ea02656

Please sign in to comment.