Potential bug and a question

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Potential bug and a question

Darrell Walisser
valgrind found some uninitialized memory in ToolDock. I don't know if it can cause a problem or not, but nonetheless it seems to have the potential (uninitialized pointers). See diff below for one way to fix it.

Also I noticed in this class (ToolDock) it is derived from wxWidgetWrapper but neither defines a virtual destructor. I can't imagine why that would be a good idea. Browsing around I can find a few more instances of this - so I guess there must be.


diff --git a/src/toolbars/ToolDock.h b/src/toolbars/ToolDock.h
index bda379e..cd74d45 100644
--- a/src/toolbars/ToolDock.h
+++ b/src/toolbars/ToolDock.h
@@ -63,8 +63,8 @@ public:
    }
 
    struct Position {
-      ToolBar *rightOf {};
-      ToolBar *below {};
+      ToolBar *rightOf {nullptr};
+      ToolBar *below {nullptr};
       bool adopt {true};
       bool valid {true};
 
@@ -325,7 +325,7 @@ public:
 
    void Updated();
 
-   int mTotalToolBarHeight;
+   int mTotalToolBarHeight = {0};
    wxWindow *mParent;
 
    ToolManager *mManager;
@@ -336,7 +336,7 @@ public:
    // Configuration as modified by the constraint of the main window width
    ToolBarConfiguration mWrappedConfiguration;
 
-   ToolBar *mBars[ ToolBarCount ];
+   ToolBar *mBars[ ToolBarCount ]= {nullptr};
 
  public:




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Loading...