Skip to content
Snippets Groups Projects
Commit d75e1472 authored by Nyx (Neal Orman)'s avatar Nyx (Neal Orman)
Browse files

EXT-2819 crash in color picker in appearance editor

Made progress by writing code to match the style we use for the texture picker.
It now should not make a difference if you destroy the color picker floater or
the color swatch control first - either direction it should do sufficient cleanup
and protection. However, still getting this crash. Will investigate further later.

Code reviewed by Seraph

--HG--
branch : avatar-pipeline
parent 37848d29
No related branches found
No related tags found
No related merge requests found
...@@ -306,6 +306,18 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op ) ...@@ -306,6 +306,18 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
} }
} }
void LLColorSwatchCtrl::onFloaterClose()
{
LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
if (pickerp)
{
pickerp->setSwatch(NULL);
}
mPickerHandle.markDead();
}
void LLColorSwatchCtrl::setValid(BOOL valid ) void LLColorSwatchCtrl::setValid(BOOL valid )
{ {
mValid = valid; mValid = valid;
...@@ -323,7 +335,7 @@ void LLColorSwatchCtrl::showPicker(BOOL take_focus) ...@@ -323,7 +335,7 @@ void LLColorSwatchCtrl::showPicker(BOOL take_focus)
if (!pickerp) if (!pickerp)
{ {
pickerp = new LLFloaterColorPicker(this, mCanApplyImmediately); pickerp = new LLFloaterColorPicker(this, mCanApplyImmediately);
gFloaterView->getParentFloater(this)->addDependentFloater(pickerp); //gFloaterView->getParentFloater(this)->addDependentFloater(pickerp);
mPickerHandle = pickerp->getHandle(); mPickerHandle = pickerp->getHandle();
} }
......
...@@ -105,6 +105,7 @@ class LLColorSwatchCtrl ...@@ -105,6 +105,7 @@ class LLColorSwatchCtrl
/*virtual*/ void setEnabled( BOOL enabled ); /*virtual*/ void setEnabled( BOOL enabled );
static void onColorChanged ( void* data, EColorPickOp pick_op = COLOR_CHANGE ); static void onColorChanged ( void* data, EColorPickOp pick_op = COLOR_CHANGE );
void onFloaterClose();
protected: protected:
BOOL mValid; BOOL mValid;
......
...@@ -241,6 +241,16 @@ BOOL LLFloaterColorPicker::postBuild() ...@@ -241,6 +241,16 @@ BOOL LLFloaterColorPicker::postBuild()
return TRUE; return TRUE;
} }
/*virtual*/
void LLFloaterColorPicker::onClose(bool app_settings)
{
if (mSwatch)
{
mSwatch->onFloaterClose();
}
stopUsingPipette();
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
void LLFloaterColorPicker::initUI ( F32 rValIn, F32 gValIn, F32 bValIn ) void LLFloaterColorPicker::initUI ( F32 rValIn, F32 gValIn, F32 bValIn )
......
...@@ -56,6 +56,7 @@ class LLFloaterColorPicker ...@@ -56,6 +56,7 @@ class LLFloaterColorPicker
// overrides // overrides
virtual BOOL postBuild (); virtual BOOL postBuild ();
virtual void onClose(bool app_settings);
virtual void draw (); virtual void draw ();
virtual BOOL handleMouseDown ( S32 x, S32 y, MASK mask ); virtual BOOL handleMouseDown ( S32 x, S32 y, MASK mask );
virtual BOOL handleMouseUp ( S32 x, S32 y, MASK mask ); virtual BOOL handleMouseUp ( S32 x, S32 y, MASK mask );
...@@ -69,6 +70,7 @@ class LLFloaterColorPicker ...@@ -69,6 +70,7 @@ class LLFloaterColorPicker
void destroyUI (); void destroyUI ();
void cancelSelection (); void cancelSelection ();
LLColorSwatchCtrl* getSwatch () { return mSwatch; }; LLColorSwatchCtrl* getSwatch () { return mSwatch; };
void setSwatch( LLColorSwatchCtrl* swatch) { mSwatch = swatch; }
// mutator / accessor for original RGB value // mutator / accessor for original RGB value
void setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn ); void setOrigRgb ( F32 origRIn, F32 origGIn, F32 origBIn );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment