From 456d351a3326e0cd48b6c8290f72d22e5d8600f7 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 6 May 2011 12:22:10 +0000 Subject: [PATCH] Fixed Coverity reported issue. CID 11831: Uninitialized pointer field (UNINIT_CTOR) Non-static class member _context is not initialized in this constructor nor in any functions that it calls. Non-static class member _dc is not initialized in this constructor nor in any functions that it calls. Non-static class member _handle is not initialized in this constructor nor in any functions that it calls. Non-static class member _instance is not initialized in this constructor nor in any functions that it calls. --- src/osgViewer/PixelBufferWin32.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/osgViewer/PixelBufferWin32.cpp b/src/osgViewer/PixelBufferWin32.cpp index 5cd6e9f73..d9f5aec46 100644 --- a/src/osgViewer/PixelBufferWin32.cpp +++ b/src/osgViewer/PixelBufferWin32.cpp @@ -188,7 +188,14 @@ static std::string sysError() class TemporaryWindow: public osg::Referenced { public: - TemporaryWindow(); + TemporaryWindow(): + _handle(0), + _dc(0), + _context(0), + _instance(0) + { + create(); + } HWND getHandle() const { return _handle; } HDC getDC() const { return _dc; } @@ -198,7 +205,13 @@ public: protected: ~TemporaryWindow(); - TemporaryWindow(const TemporaryWindow &) {} + + TemporaryWindow(const TemporaryWindow &): + _handle(0), + _dc(0), + _context(0), + _instance(0) {} + TemporaryWindow &operator=(const TemporaryWindow &) { return *this; } void create(); @@ -212,15 +225,6 @@ private: std::string _classname; }; -TemporaryWindow::TemporaryWindow() -: _handle(0), - _dc(0), - _context(0), - _instance(0) -{ - create(); -} - void TemporaryWindow::create() { std::ostringstream oss;