From 181ecd0c3bf27b47487f973fb83b988fd6ceaecf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 2 Mar 2013 21:17:13 +0300 Subject: Another fixes after Coverity checks. --- src/gui/widgets/avatarlistbox.cpp | 3 ++- src/gui/widgets/dropdown.cpp | 6 +----- src/gui/widgets/progressindicator.cpp | 4 +--- src/gui/widgets/scrollarea.cpp | 4 ++-- src/gui/widgets/window.cpp | 5 +++++ 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index b69664ddd..f2907aaf3 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -293,7 +293,8 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) } } - setWidth(parent->getWidth() - 10); + if (parent) + setWidth(parent->getWidth() - 10); BLOCK_END("AvatarListBox::draw") } diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index d4fde01dc..5cffb8d72 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -152,8 +152,7 @@ DropDown::DropDown(const Widget2 *const widget, if (listener) addActionListener(listener); - if (mPopup) - mPopup->adjustSize(); + mPopup->adjustSize(); if (mSkin) { @@ -446,9 +445,6 @@ void DropDown::adjustHeight() void DropDown::dropDown() { - if (!mPopup) - return; - if (!mDroppedDown) { mDroppedDown = true; diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index 401b45754..c0667f720 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -37,14 +37,12 @@ ProgressIndicator::ProgressIndicator() : ImageSet *const images = Theme::getImageSetFromTheme( "progress-indicator.png", 32, 32); - Animation *const anim = new Animation; if (images) { + Animation *const anim = new Animation; for (ImageSet::size_type i = 0, sz = images->size(); i < sz; ++i) anim->addFrame(images->get(i), 100, 0, 0, 100); - mIndicator = new SimpleAnimation(anim); - images->decRef(); } diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 838e5dad2..6d15c5520 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -412,7 +412,7 @@ void ScrollArea::drawButton(gcn::Graphics *const graphics, default: logger->log("ScrollArea::drawButton unknown dir: " + toString(static_cast(dir))); - break; + return; } if (buttons[dir][state]) @@ -450,7 +450,7 @@ void ScrollArea::calcButton(gcn::Graphics *const graphics, default: logger->log("ScrollArea::drawButton unknown dir: " + toString(static_cast(dir))); - break; + return; } if (buttons[dir][state]) diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index bb9e12320..54ed4764f 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -86,6 +86,11 @@ Window::Window(const std::string &caption, const bool modal, { logger->log("Window::Window(\"%s\")", caption.c_str()); +#ifndef USE_INTERNALGUICHAN + mDragOffsetX = 0; + mDragOffsetY = 0; +#endif + if (!windowContainer) throw GCN_EXCEPTION("Window::Window(): no windowContainer set"); -- cgit v1.2.3-70-g09d2