Fix for crash when first resource load is synchronous 48/25348/2
authorAndrew Cox <andrew.cox@partner.samsung.com>
Mon, 4 Aug 2014 08:21:39 +0000 (09:21 +0100)
committerAndrew Cox <andrew.cox@partner.samsung.com>
Mon, 4 Aug 2014 08:40:06 +0000 (09:40 +0100)
[problem]
If the first load of a resource executed by dali is synchronous,
it is treated as cancelled.

[solution]
Change initialisation of ResourceThreadBase members tracking
cancellation.

Change-Id: I61f4f86dbcb638fb385558429909d46d7bd066a3
Signed-off-by: Andrew Cox <andrew.cox@partner.samsung.com>
platform-abstractions/slp/resource-loader/resource-thread-base.cpp

index b5f102d4ebc897fc62cc6213a518164b0d379f92..aa3b926d4a2adcb697c7e49bb40009eaab4d1f62 100644 (file)
@@ -29,7 +29,11 @@ using boost::scoped_ptr;
 namespace Dali
 {
 
-const Integration::ResourceId NO_REQUEST = Integration::ResourceId(0) - 1;
+// Initial values for the members tracking which resources have been cancelled.
+// They start out with different values so that if the first load executed is
+// synchronous, it won't be erroneously cancelled.
+const Integration::ResourceId NO_REQUEST_IN_FLIGHT = Integration::ResourceId(0) - 1;
+const Integration::ResourceId NO_REQUEST_CANCELLED = Integration::ResourceId(0) - 2;
 
 namespace SlpPlatform
 {
@@ -44,8 +48,8 @@ class CancelRequestException {};
 
 ResourceThreadBase::ResourceThreadBase( ResourceLoader& resourceLoader ) :
   mResourceLoader( resourceLoader ),
-  mCurrentRequestId( NO_REQUEST ),
-  mCancelRequestId( NO_REQUEST ),
+  mCurrentRequestId( NO_REQUEST_IN_FLIGHT ),
+  mCancelRequestId( NO_REQUEST_CANCELLED ),
   mPaused( false )
 {
 #if defined(DEBUG_ENABLED)