diff options
author | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-03-04 19:26:07 +0200 |
---|---|---|
committer | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-03-04 19:26:07 +0200 |
commit | c077250ff16aeaf0ec4c036154a427c677e85eb3 (patch) | |
tree | cb2652f99535a5926566cf52205eb78a910fa2bb /indra | |
parent | 5cb2d63979f0ff72cb9351dc9aa070b1990a1f9c (diff) |
STORM-1016 FIXED Crash after pressing ctrl-shift-w while there is an undocked sidepanel.
Reason: The shortcut closes all floaters, including those wrapping undocked sidepanels.
The sidepanels get destroyed as well, while they are still referenced by the side tray.
Fix: Dock (i.e. move to side tray) the sidepanel before its floater gets destroyed.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llfloater.cpp | 7 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 1 | ||||
-rw-r--r-- | indra/newview/llsidetray.cpp | 37 |
3 files changed, 44 insertions, 1 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c425782715..556278b139 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2865,7 +2865,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) // close callback if (p.close_callback.isProvided()) { - mCloseSignal.connect(initCommitCallback(p.close_callback)); + setCloseCallback(initCommitCallback(p.close_callback)); } } @@ -2875,6 +2875,11 @@ boost::signals2::connection LLFloater::setMinimizeCallback( const commit_signal_ return mMinimizeSignal->connect(cb); } +boost::signals2::connection LLFloater::setCloseCallback( const commit_signal_t::slot_type& cb ) +{ + return mCloseSignal.connect(cb); +} + LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build"); bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index bb96272d02..79570720cc 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -144,6 +144,7 @@ public: bool buildFromFile(const std::string &filename, LLXMLNodePtr output_node = NULL); boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setCloseCallback( const commit_signal_t::slot_type& cb ); void initFromParams(const LLFloater::Params& p); bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL); diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index eb537c7d7b..6267242e28 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -96,6 +96,7 @@ bool LLSideTray::instanceCreated () class LLSideTrayTab: public LLPanel { + LOG_CLASS(LLSideTrayTab); friend class LLUICtrlFactory; friend class LLSideTray; public: @@ -122,6 +123,8 @@ protected: void undock(LLFloater* floater_tab); LLSideTray* getSideTray(); + + void onFloaterClose(LLSD::Boolean app_quitting); public: virtual ~LLSideTrayTab(); @@ -140,6 +143,8 @@ public: void onOpen (const LLSD& key); void toggleTabDocked(); + void setDocked(bool dock); + bool isDocked() const; BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); @@ -151,6 +156,7 @@ private: std::string mDescription; LLView* mMainPanel; + boost::signals2::connection mFloaterCloseConn; }; LLSideTrayTab::LLSideTrayTab(const Params& p) @@ -271,6 +277,35 @@ void LLSideTrayTab::toggleTabDocked() LLFloaterReg::toggleInstance("side_bar_tab", tab_name); } +// Same as toggleTabDocked() apart from making sure that we do exactly what we want. +void LLSideTrayTab::setDocked(bool dock) +{ + if (isDocked() == dock) + { + llwarns << "Tab " << getName() << " is already " << (dock ? "docked" : "undocked") << llendl; + return; + } + + toggleTabDocked(); +} + +bool LLSideTrayTab::isDocked() const +{ + return dynamic_cast<LLSideTray*>(getParent()) != NULL; +} + +void LLSideTrayTab::onFloaterClose(LLSD::Boolean app_quitting) +{ + // If user presses Ctrl-Shift-W, handle that gracefully by docking all + // undocked tabs before their floaters get destroyed (STORM-1016). + + // Don't dock on quit for the current dock state to be correctly saved. + if (app_quitting) return; + + lldebugs << "Forcibly docking tab " << getName() << llendl; + setDocked(true); +} + BOOL LLSideTrayTab::handleScrollWheel(S32 x, S32 y, S32 clicks) { // Let children handle the event @@ -294,6 +329,7 @@ void LLSideTrayTab::dock(LLFloater* floater_tab) return; } + mFloaterCloseConn.disconnect(); setRect(side_tray->getLocalRect()); reshape(getRect().getWidth(), getRect().getHeight()); @@ -342,6 +378,7 @@ void LLSideTrayTab::undock(LLFloater* floater_tab) } floater_tab->addChild(this); + mFloaterCloseConn = floater_tab->setCloseCallback(boost::bind(&LLSideTrayTab::onFloaterClose, this, _2)); floater_tab->setTitle(mTabTitle); floater_tab->setName(getName()); |