Fixed Coverity reported issues.

WindowManager.cpp
CID 11841: Uninitialized pointer field (UNINIT_CTOR)
Non-static class member _lastEvent is not initialized in this constructor nor in any functions that it calls.
Non-static class member _lastPush is not initialized in this constructor nor in any functions that it calls.
Non-static class member _view is not initialized in this constructor nor in any functions that it calls.

Frame.cpp
CID 11840: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _flags is not initialized in this constructor nor in any functions that it calls.

Window.cpp
CID 11839: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _index is not initialized in this constructor nor in any functions that it calls.
This commit is contained in:
Robert Osfield
2011-05-06 10:29:47 +00:00
parent 3d300c38d0
commit 4f5152152d
4 changed files with 63 additions and 42 deletions

View File

@@ -165,13 +165,14 @@ bool Frame::Border::mouseDrag(double x, double y, const WindowManager* wm)
}
Frame::Frame(const std::string& name, unsigned int flags):
Table (name, 3, 3),
_flags (flags)
Table (name, 3, 3),
_flags (flags)
{
}
Frame::Frame(const Frame& frame, const osg::CopyOp& co):
Table(frame, co)
Table(frame, co),
_flags(frame._flags)
{
}

View File

@@ -139,20 +139,21 @@ void Window::EmbeddedWindow::updateSizeFromWindow() {
}
Window::Window(const std::string& name):
_parent (0),
_wm (0),
_index (0),
_x (0.0f),
_y (0.0f),
_z (0.0f),
_zRange (0.0f),
_strata (STRATA_NONE),
_vis (VM_FULL),
_r (0.0f),
_s (1.0f),
_scaleDenom (100.0f),
_vAnchor (VA_NONE),
_hAnchor (HA_NONE) {
_parent (0),
_wm (0),
_index (0),
_x (0.0f),
_y (0.0f),
_z (0.0f),
_zRange (0.0f),
_strata (STRATA_NONE),
_vis (VM_FULL),
_r (0.0f),
_s (1.0f),
_scaleDenom (100.0f),
_vAnchor (VA_NONE),
_hAnchor (HA_NONE)
{
_name = name.size() ? name : generateRandomName("Window");
// TODO: Fix the "bg" name.
@@ -177,25 +178,27 @@ _hAnchor (HA_NONE) {
}
Window::Window(const Window& window, const osg::CopyOp& co):
MatrixTransform (window, co),
EventInterface (window),
StyleInterface (window),
_parent (0),
_wm (0),
_x (window._x),
_y (window._y),
_z (window._z),
_zRange (window._zRange),
_strata (window._strata),
_vis (window._vis),
_r (window._r),
_s (window._s),
_scaleDenom (window._scaleDenom),
_width (window._width),
_height (window._height),
_vAnchor (window._vAnchor),
_hAnchor (window._hAnchor),
_visibleArea (window._visibleArea) {
MatrixTransform (window, co),
EventInterface (window),
StyleInterface (window),
_parent (0),
_wm (0),
_index (0),
_x (window._x),
_y (window._y),
_z (window._z),
_zRange (window._zRange),
_strata (window._strata),
_vis (window._vis),
_r (window._r),
_s (window._s),
_scaleDenom (window._scaleDenom),
_width (window._width),
_height (window._height),
_vAnchor (window._vAnchor),
_hAnchor (window._hAnchor),
_visibleArea (window._visibleArea)
{
// Construct our vector of Widgets for easier use. :)
// TODO: I almost certainly will need to use the getPosition() thing here eventually
// for things to work 100% properly. For example, some Geodes may contain labels,

View File

@@ -25,8 +25,6 @@ _width (width),
_height (height),
_windowWidth (width),
_windowHeight (height),
_numForeground (0.0f),
_numBackground (0.0f),
_flags (flags),
_nodeMask (nodeMask),
_view (view),
@@ -89,10 +87,31 @@ _styleManager (new StyleManager()) {
}
WindowManager::WindowManager(const WindowManager& wm, const osg::CopyOp& co):
osg::Switch(wm, co) {
osg::Switch(wm, co),
_width (wm._width),
_height (wm._height),
_windowWidth (wm._width),
_windowHeight (wm._height),
_flags (wm._flags),
_nodeMask (wm._nodeMask),
_view (wm._view),
_lastX (0.0f),
_lastY (0.0f),
_lastEvent (0),
_lastPush (0),
_lastVertical (PD_NONE),
_lastHorizontal (PD_NONE),
_focusMode (PFM_FOCUS),
_leftDown (false),
_middleDown (false),
_rightDown (false),
_scrolling (osgGA::GUIEventAdapter::SCROLL_NONE),
_styleManager (new StyleManager())
{
}
WindowManager::~WindowManager() {
WindowManager::~WindowManager()
{
if(_flags & WM_USE_LUA) _lua->close();
if(_flags & WM_USE_PYTHON) _python->close();