diff options
Diffstat (limited to 'indra/llmessage/lltransfertargetvfile.cpp')
-rw-r--r--[-rwxr-xr-x] | indra/llmessage/lltransfertargetvfile.cpp | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp index 3c234b9726..a572c68a7f 100755..100644 --- a/indra/llmessage/lltransfertargetvfile.cpp +++ b/indra/llmessage/lltransfertargetvfile.cpp @@ -42,7 +42,7 @@ LLTransferTargetParamsVFile::LLTransferTargetParamsVFile() : LLTransferTargetParams(LLTTT_VFILE), mAssetType(LLAssetType::AT_NONE), mCompleteCallback(NULL), - mUserDatap(NULL), + mRequestDatap(NULL), mErrCode(0) { } @@ -55,10 +55,14 @@ void LLTransferTargetParamsVFile::setAsset( mAssetType = asset_type; } -void LLTransferTargetParamsVFile::setCallback(LLTTVFCompleteCallback cb, void *user_data) +void LLTransferTargetParamsVFile::setCallback(LLTTVFCompleteCallback cb, LLBaseDownloadRequest& request) { mCompleteCallback = cb; - mUserDatap = user_data; + if (mRequestDatap) + { + delete mRequestDatap; + } + mRequestDatap = request.getCopy(); } bool LLTransferTargetParamsVFile::unpackParams(LLDataPacker& dp) @@ -98,6 +102,12 @@ LLTransferTargetVFile::LLTransferTargetVFile( LLTransferTargetVFile::~LLTransferTargetVFile() { + if (mParams.mRequestDatap) + { + // TODO: Consider doing it in LLTransferTargetParamsVFile's destructor + delete mParams.mRequestDatap; + mParams.mRequestDatap = NULL; + } } @@ -208,12 +218,18 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status) err_code = LL_ERR_ASSET_REQUEST_FAILED; break; } - if (mParams.mCompleteCallback) - { - mParams.mCompleteCallback(err_code, - mParams.getAssetID(), - mParams.getAssetType(), - mParams.mUserDatap, - LL_EXSTAT_NONE); - } + + if (mParams.mRequestDatap) + { + if (mParams.mCompleteCallback) + { + mParams.mCompleteCallback(err_code, + mParams.getAssetID(), + mParams.getAssetType(), + mParams.mRequestDatap, + LL_EXSTAT_NONE); + } + delete mParams.mRequestDatap; + mParams.mRequestDatap = NULL; + } } |