diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llmessage/llassetstorage.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/linden/indra/llmessage/llassetstorage.cpp b/linden/indra/llmessage/llassetstorage.cpp index fa14a2b..2d85011 100644 --- a/linden/indra/llmessage/llassetstorage.cpp +++ b/linden/indra/llmessage/llassetstorage.cpp | |||
@@ -522,16 +522,19 @@ void LLAssetStorage::downloadCompleteCallback( | |||
522 | S32 result, | 522 | S32 result, |
523 | const LLUUID& file_id, | 523 | const LLUUID& file_id, |
524 | LLAssetType::EType file_type, | 524 | LLAssetType::EType file_type, |
525 | void* user_data, LLExtStat ext_status) | 525 | void* callback_parm_req, LLExtStat ext_status) |
526 | { | 526 | { |
527 | lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id | 527 | lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id |
528 | << "," << LLAssetType::lookup(file_type) << llendl; | 528 | << "," << LLAssetType::lookup(file_type) << llendl; |
529 | LLAssetRequest* req = (LLAssetRequest*)user_data; | 529 | |
530 | // be careful! req may be a ptr to memory already freed (a timeout does this) | ||
531 | LLAssetRequest* req = (LLAssetRequest*)callback_parm_req; | ||
530 | if(!req) | 532 | if(!req) |
531 | { | 533 | { |
532 | llwarns << "LLAssetStorage::downloadCompleteCallback called without" | 534 | llwarns << "LLAssetStorage::downloadCompleteCallback called without" |
533 | "a valid request." << llendl; | 535 | "a valid request." << llendl; |
534 | return; | 536 | // we can live with a null pointer, we're not allowed to deref the ptr anyway (see above) |
537 | // return; | ||
535 | } | 538 | } |
536 | if (!gAssetStorage) | 539 | if (!gAssetStorage) |
537 | { | 540 | { |
@@ -539,12 +542,10 @@ void LLAssetStorage::downloadCompleteCallback( | |||
539 | return; | 542 | return; |
540 | } | 543 | } |
541 | 544 | ||
542 | req->setUUID(file_id); | ||
543 | req->setType(file_type); | ||
544 | if (LL_ERR_NOERR == result) | 545 | if (LL_ERR_NOERR == result) |
545 | { | 546 | { |
546 | // we might have gotten a zero-size file | 547 | // we might have gotten a zero-size file |
547 | LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType()); | 548 | LLVFile vfile(gAssetStorage->mVFS, file_id, file_type); |
548 | if (vfile.getSize() <= 0) | 549 | if (vfile.getSize() <= 0) |
549 | { | 550 | { |
550 | llwarns << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << llendl; | 551 | llwarns << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << llendl; |
@@ -563,7 +564,7 @@ void LLAssetStorage::downloadCompleteCallback( | |||
563 | { | 564 | { |
564 | request_list_t::iterator curiter = iter++; | 565 | request_list_t::iterator curiter = iter++; |
565 | LLAssetRequest* tmp = *curiter; | 566 | LLAssetRequest* tmp = *curiter; |
566 | if ((tmp->getUUID() == req->getUUID()) && (tmp->getType()== req->getType())) | 567 | if ((tmp->getUUID() == file_id) && (tmp->getType() == file_type)) |
567 | { | 568 | { |
568 | requests.push_front(tmp); | 569 | requests.push_front(tmp); |
569 | iter = gAssetStorage->mPendingDownloads.erase(curiter); | 570 | iter = gAssetStorage->mPendingDownloads.erase(curiter); |
@@ -576,7 +577,7 @@ void LLAssetStorage::downloadCompleteCallback( | |||
576 | LLAssetRequest* tmp = *curiter; | 577 | LLAssetRequest* tmp = *curiter; |
577 | if (tmp->mDownCallback) | 578 | if (tmp->mDownCallback) |
578 | { | 579 | { |
579 | tmp->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), tmp->mUserData, result, ext_status); | 580 | tmp->mDownCallback(gAssetStorage->mVFS, tmp->getUUID(), tmp->getType(), tmp->mUserData, result, ext_status); |
580 | } | 581 | } |
581 | delete tmp; | 582 | delete tmp; |
582 | } | 583 | } |
@@ -672,10 +673,10 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback( | |||
672 | S32 result, | 673 | S32 result, |
673 | const LLUUID& file_id, | 674 | const LLUUID& file_id, |
674 | LLAssetType::EType file_type, | 675 | LLAssetType::EType file_type, |
675 | void* user_data, | 676 | void* callback_parm_req, |
676 | LLExtStat ext_status) | 677 | LLExtStat ext_status) |
677 | { | 678 | { |
678 | LLEstateAssetRequest *req = (LLEstateAssetRequest*)user_data; | 679 | LLEstateAssetRequest *req = (LLEstateAssetRequest*)callback_parm_req; |
679 | if(!req) | 680 | if(!req) |
680 | { | 681 | { |
681 | llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" | 682 | llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" |
@@ -689,12 +690,10 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback( | |||
689 | return; | 690 | return; |
690 | } | 691 | } |
691 | 692 | ||
692 | req->setUUID(file_id); | ||
693 | req->setType(file_type); | ||
694 | if (LL_ERR_NOERR == result) | 693 | if (LL_ERR_NOERR == result) |
695 | { | 694 | { |
696 | // we might have gotten a zero-size file | 695 | // we might have gotten a zero-size file |
697 | LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType()); | 696 | LLVFile vfile(gAssetStorage->mVFS, file_id, file_type); |
698 | if (vfile.getSize() <= 0) | 697 | if (vfile.getSize() <= 0) |
699 | { | 698 | { |
700 | llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; | 699 | llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; |
@@ -704,7 +703,9 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback( | |||
704 | } | 703 | } |
705 | } | 704 | } |
706 | 705 | ||
707 | req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getAType(), req->mUserData, result, ext_status); | 706 | req->mDownCallback(gAssetStorage->mVFS, file_id, file_type, req->mUserData, result, ext_status); |
707 | |||
708 | delete req; | ||
708 | } | 709 | } |
709 | 710 | ||
710 | void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, | 711 | void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id, |
@@ -809,10 +810,10 @@ void LLAssetStorage::downloadInvItemCompleteCallback( | |||
809 | S32 result, | 810 | S32 result, |
810 | const LLUUID& file_id, | 811 | const LLUUID& file_id, |
811 | LLAssetType::EType file_type, | 812 | LLAssetType::EType file_type, |
812 | void* user_data, | 813 | void* callback_parm_req, |
813 | LLExtStat ext_status) | 814 | LLExtStat ext_status) |
814 | { | 815 | { |
815 | LLInvItemRequest *req = (LLInvItemRequest*)user_data; | 816 | LLInvItemRequest *req = (LLInvItemRequest*)callback_parm_req; |
816 | if(!req) | 817 | if(!req) |
817 | { | 818 | { |
818 | llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" | 819 | llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" |
@@ -825,12 +826,10 @@ void LLAssetStorage::downloadInvItemCompleteCallback( | |||
825 | return; | 826 | return; |
826 | } | 827 | } |
827 | 828 | ||
828 | req->setUUID(file_id); | ||
829 | req->setType(file_type); | ||
830 | if (LL_ERR_NOERR == result) | 829 | if (LL_ERR_NOERR == result) |
831 | { | 830 | { |
832 | // we might have gotten a zero-size file | 831 | // we might have gotten a zero-size file |
833 | LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType()); | 832 | LLVFile vfile(gAssetStorage->mVFS, file_id, file_type); |
834 | if (vfile.getSize() <= 0) | 833 | if (vfile.getSize() <= 0) |
835 | { | 834 | { |
836 | llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; | 835 | llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; |
@@ -840,7 +839,9 @@ void LLAssetStorage::downloadInvItemCompleteCallback( | |||
840 | } | 839 | } |
841 | } | 840 | } |
842 | 841 | ||
843 | req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), req->mUserData, result, ext_status); | 842 | req->mDownCallback(gAssetStorage->mVFS, file_id, file_type, req->mUserData, result, ext_status); |
843 | |||
844 | delete req; | ||
844 | } | 845 | } |
845 | 846 | ||
846 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 847 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// |