fix for STORM-973: [crashhunters] crash at LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *)7
Review Request #252 - Created April 5, 2011 and submitted
Xiaohong Bao | Reviewers | ||
https://bitbucket.org/BaoLinden/viewer-development-storm-973 | viewer | ||
storm-973 | |||
None | viewer-development |
this is to resubmit the patch for storm-973. We are not very clear what causes this. But this fix is targeting three most possible causes: 1, a texture is failed to add into mImageList but its flag is set to be successful; 2, a texture status is changed not from the main thread, because gTextureList is not thread-safe; 3, gTextureList is accessed before it is initialized. I regenerated the viewer-development-storm-973 branch based on the latest viewer-development branch. If you still can not apply the patch directly, I am afraid you should do the manual merge. Otherwise grant me the permission, I will do it.
Posted (April 8, 2011, 10:08 a.m.)
A description would not hurt: * What caused the bug? * What fixes it?
Review request changed
Updated (April 8, 2011, 10:26 a.m.)
-
this is to resubmit the patch for storm-973.
this is to resubmit the patch for storm-973. We are not very clear what causes this. But this fix is targeting three most possible causes: 1, a texture is failed to add into mImageList but its flag is set to be successful; 2, a texture status is changed not from the main thread, because gTextureList is not thread-safe; 3, gTextureList is accessed before it is initialized. I regenerated the viewer-development-storm-973 branch based on the latest viewer-development branch. If you still can not apply the patch directly, I am afraid you should do the manual merge. Otherwise grant me the permission, I will do it.
I changed the description of the review: added the possible causes of this bug. I regenerated the viewer-development-storm-973 branch based on the latest viewer-development branch. If you still can not apply the patch directly, I am afraid you should do the manual merge. Otherwise grant me the permission, I will do it.
Posted (April 8, 2011, 12:53 p.m.)
-
indra/newview/llviewertexturelist.cpp (Diff revision 1) -
Almost every line of this method is a potential crasher. Are you sure we should handle errors this way? I would: * Add a NULL check for the "image" parameter (besides the llassert which is not evaluated in release builds). * Try handling the other errors without crashing, by issuing a warning and returning FALSE. Otherwise we may fix one crash and add two.
-
indra/newview/llviewertexturelist.cpp (Diff revision 1) -
ditto
-
indra/newview/llviewertexturelist.cpp (Diff revision 1) -
* No check for mInitialized before accessing sRenderThreadID. * I don't quite get what you're trying to achieve here by passing sRenderThreadID. It doesn't guarantee that the method is invoked from thread #<sRenderThreadID>, does it?
Posted (April 8, 2011, 3:48 p.m.)
I guess there is no real reason why there's a space before some semicolons but not others, or is there? Even although I like to look with the space there, I think we should remove those spaces to be consistent with common practice.
-
indra/newview/llviewertexturelist.h (Diff revision 1) -
Any reason for this to be BOOL instead of bool? Also, remove the space between the name and the semicolon.
-
indra/newview/llviewertexturelist.cpp (Diff revision 1) -
Remove space between value and semicolon.
-
indra/newview/llviewertexturelist.cpp (Diff revision 1) -
I guess the intention is that this gets only executed by one single thread. (And probably only once?) So before setting sRenderThreadID to the current thread's ID, we might want to assert that it hasn't been changed before (i.e., is still 0). (If we want to allow to execute this assignment several times but only by one thread, check whether it's 0 or already has the value of LLThread::currentID().)
-
indra/newview/llviewertexturelist.cpp (Diff revision 1) -
Remove space before semicolon.
-
indra/newview/llviewertexturelist.cpp (Diff revision 1) -
Same here.
-
indra/newview/llviewertexturelist.cpp (Diff revision 1) -
And while we're at it, here, too.
-
indra/newview/llviewertexturelist.cpp (Diff revision 1) -
And there's more of these spaces. (I won't comment on all.)
Other reviews