Skip to content

Commit

Permalink
Sync with obsidian in attempt to fix SV-2086
Browse files Browse the repository at this point in the history
Applies MAINT-4897 FIXED Frequent error when texturing a linkset - "Unable to add texture. Please wait a few seconds and try again."
Applies MAINT-5547 FIXED errors when texturing a linkset "Unable to add texture. Please wait a few seconds and try again."
  • Loading branch information
LiruMouse committed Jul 7, 2016
1 parent a6e9050 commit 873b399
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 23 deletions.
21 changes: 13 additions & 8 deletions indra/newview/lltooldraganddrop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,11 +976,14 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
return TRUE;
}

// In case the inventory has not been updated (e.g. due to some recent operation
// causing a dirty inventory), stall the user while fetching the inventory.
if (hit_obj->isInventoryDirty())
{
hit_obj->fetchInventoryFromServer();
// In case the inventory has not been loaded (e.g. due to some recent operation
// causing a dirty inventory) and we can do an update, stall the user
// while fetching the inventory.
//
// Fetch if inventory is dirty and listener is present (otherwise we will not receive update)
if (hit_obj->isInventoryDirty() && hit_obj->hasInventoryListeners())
{
hit_obj->requestInventory();
LLSD args;
args["ERROR_MESSAGE"] = "Unable to add texture.\nPlease wait a few seconds and try again.";
LLNotificationsUtil::add("ErrorMessage", args);
Expand Down Expand Up @@ -1060,10 +1063,12 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
{
hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
}
// Force the object to update its refetch its inventory so it has this texture.
hit_obj->fetchInventoryFromServer();
// Force the object to update and refetch its inventory so it has this texture.
hit_obj->dirtyInventory();
hit_obj->requestInventory();
// TODO: Check to see if adding the item was successful; if not, then
// we should return false here.
// we should return false here. This will requre a separate listener
// since without listener, we have no way to receive update
}
return TRUE;
}
Expand Down
16 changes: 12 additions & 4 deletions indra/newview/llviewerobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2594,22 +2594,32 @@ void LLViewerObject::clearInventoryListeners()
mInventoryCallbacks.clear();
}

bool LLViewerObject::hasInventoryListeners()
{
return !mInventoryCallbacks.empty();
}

void LLViewerObject::requestInventory()
{
if(mInventoryDirty && mInventory && !mInventoryCallbacks.empty())
{
mInventory->clear(); // will deref and delete entries
delete mInventory;
mInventory = NULL;
mInventoryDirty = FALSE; //since we are going to request it now
}

if(mInventory)
{
// inventory is either up to date or doesn't has a listener
// if it is dirty, leave it this way in case we gain a listener
doInventoryCallback();
}
// throw away duplicate requests
else
{
// since we are going to request it now
mInventoryDirty = FALSE;

// Note: throws away duplicate requests
fetchInventoryFromServer();
}
}
Expand All @@ -2619,8 +2629,6 @@ void LLViewerObject::fetchInventoryFromServer()
if (!mInventoryPending)
{
delete mInventory;
mInventory = NULL;
mInventoryDirty = FALSE;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RequestTaskInventory);
msg->nextBlockFast(_PREHASH_AgentData);
Expand Down
25 changes: 14 additions & 11 deletions indra/newview/llviewerobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,27 @@ class LLAgent; // TODO: Get rid of this.
class LLAudioSource;
class LLAudioSourceVO;
class LLBBox;
class LLDataPacker;
class LLColor4;
class LLFrameTimer;
class LLDataPacker;
class LLDrawable;
class LLFrameTimer;
class LLHost;
class LLWorld;
class LLMessageSystem;
class LLNameValue;
class LLNetMap;
class LLMessageSystem;
class LLPartSysData;
class LLPrimitive;
class LLPipeline;
class LLPrimitive;
class LLTextureEntry;
class LLViewerTexture;
class LLVOAvatar;
class LLVOInventoryListener;
class LLViewerInventoryItem;
class LLViewerObject;
class LLViewerObjectMedia;
class LLViewerPartSourceScript;
class LLViewerRegion;
class LLViewerObjectMedia;
class LLVOInventoryListener;
class LLVOAvatar;
class LLViewerTexture;
class LLWorld;

typedef enum e_object_update_type
{
Expand Down Expand Up @@ -112,7 +112,7 @@ struct PotentialReturnableObject

//============================================================================

class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
class LLViewerObject: public LLPrimitive, public LLRefCount, public LLGLUpdate
{
protected:
~LLViewerObject(); // use unref()
Expand Down Expand Up @@ -446,8 +446,8 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
void removeInventoryListener(LLVOInventoryListener* listener);
BOOL isInventoryPending() { return mInventoryPending; }
void clearInventoryListeners();
bool hasInventoryListeners();
void requestInventory();
void fetchInventoryFromServer();
static void processTaskInv(LLMessageSystem* msg, void** user_data);
void removeInventory(const LLUUID& item_id);

Expand Down Expand Up @@ -595,6 +595,9 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
// Motion prediction between updates
void interpolateLinearMotion(const F64SecondsImplicit & time, const F32SecondsImplicit & dt);

// forms task inventory request if none are pending
void fetchInventoryFromServer();

public:
//
// Viewer-side only types - use the LL_PCODE_APP mask.
Expand Down

0 comments on commit 873b399

Please sign in to comment.