-
Notifications
You must be signed in to change notification settings - Fork 69
Fix null outfit gallery observer pointer #4135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures the mOutfitsObserver
member is initialized before any use in updateAddedCategory
, preventing a null-pointer crash.
- Moved observer initialization to the start of
updateAddedCategory
. - Removed the duplicate observer creation block later in the method.
Why does this use mOutfitsObserver isntead of inherited mCategoriesObserver? |
@akleshchev Not sure - sounds like a good opportunity to consolidate though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces a dedicated mOutfitsObserver
with the shared mCategoriesObserver
to prevent null-pointer crashes in the outfit gallery and removes redundant observer management code.
- Deleted
mOutfitsObserver
member and its init/cleanup - Updated all
addCategory
/removeCategory
calls to usemCategoriesObserver
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
indra/newview/lloutfitgallery.h | Removed mOutfitsObserver declaration |
indra/newview/lloutfitgallery.cpp | Deleted init/remove of old observer and switched calls to mCategoriesObserver |
Comments suppressed due to low confidence (2)
indra/newview/lloutfitgallery.cpp:729
- The destructor no longer unregisters or deletes
mCategoriesObserver
. Verify that cleanup is handled in the base class or reintroduce proper removal to avoid dangling observers or memory leaks.
LLOutfitGallery::~LLOutfitGallery()
indra/newview/lloutfitgallery.cpp:793
- Ensure that
mCategoriesObserver
is initialized and registered withgInventory
before use; otherwise these calls may still dereference a null pointer.
mCategoriesObserver->addCategory(cat_id, [this, outfits]()
@akleshchev @maxim-productengine Go ahead and give this a re-review. From my testing, there doesn't seem to be any issues. |
Fixes a null pointer crash in the outfit gallery I managed to hit on macOS working on some stuff.