From bea3b937d9907e4491caaec909cd404d401694ac Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 11 Nov 2009 16:12:25 -0800 Subject: Fix a potential crash if scroll button is not there --- indra/newview/llpanelprimmediacontrols.cpp | 64 +++++++++++++++++++----------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 5c3c260549..24de2dcdfc 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -118,21 +118,33 @@ LLPanelPrimMediaControls::~LLPanelPrimMediaControls() BOOL LLPanelPrimMediaControls::postBuild() { LLButton* scroll_up_ctrl = getChild("scrollup"); - scroll_up_ctrl->setClickedCallback(onScrollUp, this); - scroll_up_ctrl->setHeldDownCallback(onScrollUpHeld, this); - scroll_up_ctrl->setMouseUpCallback(onScrollStop, this); + if (scroll_up_ctrl) + { + scroll_up_ctrl->setClickedCallback(onScrollUp, this); + scroll_up_ctrl->setHeldDownCallback(onScrollUpHeld, this); + scroll_up_ctrl->setMouseUpCallback(onScrollStop, this); + } LLButton* scroll_left_ctrl = getChild("scrollleft"); - scroll_left_ctrl->setClickedCallback(onScrollLeft, this); - scroll_left_ctrl->setHeldDownCallback(onScrollLeftHeld, this); - scroll_left_ctrl->setMouseUpCallback(onScrollStop, this); + if (scroll_left_ctrl) + { + scroll_left_ctrl->setClickedCallback(onScrollLeft, this); + scroll_left_ctrl->setHeldDownCallback(onScrollLeftHeld, this); + scroll_left_ctrl->setMouseUpCallback(onScrollStop, this); + } LLButton* scroll_right_ctrl = getChild("scrollright"); - scroll_right_ctrl->setClickedCallback(onScrollRight, this); - scroll_right_ctrl->setHeldDownCallback(onScrollRightHeld, this); - scroll_right_ctrl->setMouseUpCallback(onScrollStop, this); + if (scroll_right_ctrl) + { + scroll_right_ctrl->setClickedCallback(onScrollRight, this); + scroll_right_ctrl->setHeldDownCallback(onScrollRightHeld, this); + scroll_right_ctrl->setMouseUpCallback(onScrollStop, this); + } LLButton* scroll_down_ctrl = getChild("scrolldown"); - scroll_down_ctrl->setClickedCallback(onScrollDown, this); - scroll_down_ctrl->setHeldDownCallback(onScrollDownHeld, this); - scroll_down_ctrl->setMouseUpCallback(onScrollStop, this); + if (scroll_down_ctrl) + { + scroll_down_ctrl->setClickedCallback(onScrollDown, this); + scroll_down_ctrl->setHeldDownCallback(onScrollDownHeld, this); + scroll_down_ctrl->setMouseUpCallback(onScrollStop, this); + } LLUICtrl* media_address = getChild("media_address"); media_address->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this )); @@ -326,11 +338,14 @@ void LLPanelPrimMediaControls::updateShape() whitelist_icon->setVisible(false); secure_lock_icon->setVisible(false); - scroll_up_ctrl->setVisible(false); - scroll_left_ctrl->setVisible(false); - scroll_right_ctrl->setVisible(false); - scroll_down_ctrl->setVisible(false); - media_panel_scroll->setVisible(false); + if (media_panel_scroll) + { + media_panel_scroll->setVisible(false); + scroll_up_ctrl->setVisible(false); + scroll_left_ctrl->setVisible(false); + scroll_right_ctrl->setVisible(false); + scroll_down_ctrl->setVisible(false); + } F32 volume = media_impl->getVolume(); // movie's url changed @@ -422,12 +437,15 @@ void LLPanelPrimMediaControls::updateShape() volume_ctrl->setEnabled(FALSE); volume_up_ctrl->setEnabled(FALSE); volume_down_ctrl->setEnabled(FALSE); - - scroll_up_ctrl->setVisible(has_focus); - scroll_left_ctrl->setVisible(has_focus); - scroll_right_ctrl->setVisible(has_focus); - scroll_down_ctrl->setVisible(has_focus); - media_panel_scroll->setVisible(has_focus); + + if (media_panel_scroll) + { + media_panel_scroll->setVisible(has_focus); + scroll_up_ctrl->setVisible(has_focus); + scroll_left_ctrl->setVisible(has_focus); + scroll_right_ctrl->setVisible(has_focus); + scroll_down_ctrl->setVisible(has_focus); + } // TODO: get the secure lock bool from media plug in std::string prefix = std::string("https://"); std::string test_prefix = mCurrentURL.substr(0, prefix.length()); -- cgit v1.2.3