Make sure to not use floaters of different type than LLPreview as LLPreview instance.

master
Nicky 2012-05-30 23:46:41 +02:00
parent e963cefea5
commit e8bebc5b3c
1 changed files with 13 additions and 4 deletions

View File

@ -464,7 +464,9 @@ LLMultiPreview::LLMultiPreview()
void LLMultiPreview::onOpen(const LLSD& key)
{
LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel();
// Floater could be something else than LLPreview, eg LLFloaterProfile.
LLPreview* frontmost_preview = dynamic_cast<LLPreview*>(mTabContainer->getCurrentPanel());
if (frontmost_preview && frontmost_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED)
{
frontmost_preview->loadAsset();
@ -477,8 +479,13 @@ void LLMultiPreview::handleReshape(const LLRect& new_rect, bool by_user)
{
if(new_rect.getWidth() != getRect().getWidth() || new_rect.getHeight() != getRect().getHeight())
{
LLPreview* frontmost_preview = (LLPreview*)mTabContainer->getCurrentPanel();
if (frontmost_preview) frontmost_preview->userResized();
// Floater could be something else than LLPreview, eg LLFloaterProfile.
LLPreview* frontmost_preview = dynamic_cast<LLPreview*>(mTabContainer->getCurrentPanel());
if (frontmost_preview)
{
frontmost_preview->userResized();
}
}
LLFloater::handleReshape(new_rect, by_user);
}
@ -486,7 +493,9 @@ void LLMultiPreview::handleReshape(const LLRect& new_rect, bool by_user)
void LLMultiPreview::tabOpen(LLFloater* opened_floater, bool from_click)
{
LLPreview* opened_preview = (LLPreview*)opened_floater;
// Floater could be something else than LLPreview, eg LLFloaterProfile.
LLPreview* opened_preview = dynamic_cast<LLPreview*>(opened_floater);
if (opened_preview && opened_preview->getAssetStatus() == LLPreview::PREVIEW_ASSET_UNLOADED)
{
opened_preview->loadAsset();