summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-03-13 20:42:13 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-03-13 20:48:16 +0000
commita6435dc298a7dec944eedadd46a17fa6d76e5169 (patch)
tree62bd3c375e99395d1a17e2601e1b187f4496faaf
parente1c9efceaef0f706889aa987def592d7ae62285a (diff)
coverity#1355505 Uninitialized pointer field
Change-Id: I95259c8a572529f47ef4fddf59f9ca29d078b6f4
-rw-r--r--include/vcl/toolbox.hxx1
-rw-r--r--vcl/source/window/toolbox.cxx23
2 files changed, 18 insertions, 6 deletions
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index da057b88c4a7..b0a686f36f02 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -159,6 +159,7 @@ private:
bool bInvalidateLower = true);
SAL_DLLPRIVATE void InvalidateMenuButton();
+ SAL_DLLPRIVATE void ImplInitToolBoxData();
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
using DockingWindow::ImplInitSettings;
SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 075e44e989b7..b638fc75bcc0 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1343,11 +1343,11 @@ IMPL_LINK_TYPED( ImplTBDragMgr, SelectHdl, Accelerator&, rAccel, void )
EndDragging();
}
-void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
+void ToolBox::ImplInitToolBoxData()
{
// initialize variables
- ImplGetWindowImpl()->mbToolBox = true;
- mpData = new ImplToolBoxPrivateData;
+ ImplGetWindowImpl()->mbToolBox = true;
+ mpData = new ImplToolBoxPrivateData;
mpFloatWin = nullptr;
mnDX = 0;
mnDY = 0;
@@ -1383,18 +1383,18 @@ void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
mbFormat = false;
mbFullPaint = false;
mbHorz = true;
- mbScroll = (nStyle & WB_SCROLL) != 0;
+ mbScroll = false;
mbCustomize = false;
mbCustomizeMode = false;
mbDragging = false;
mbMenuStrings = false;
- mbIsShift = false;
+ mbIsShift = false;
mbIsKeyEvent = false;
mbChangingHighlight = false;
meButtonType = ButtonType::SYMBOLONLY;
meAlign = WindowAlign::Top;
meLastStyle = PointerStyle::Arrow;
- mnWinStyle = nStyle;
+ mnWinStyle = 0;
meLayoutMode = TBX_LAYOUT_NORMAL;
mnLastFocusItemId = 0;
mnKeyModifier = 0;
@@ -1408,6 +1408,13 @@ void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
// set timeout and handler for dropdown items
mpData->maDropdownTimer.SetTimeout( 250 );
mpData->maDropdownTimer.SetTimeoutHdl( LINK( this, ToolBox, ImplDropdownLongClickHdl ) );
+}
+
+void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
+{
+ // initialize variables
+ mbScroll = (nStyle & WB_SCROLL) != 0;
+ mnWinStyle = nStyle;
DockingWindow::ImplInit( pParent, nStyle & ~(WB_BORDER) );
@@ -1604,6 +1611,7 @@ void ToolBox::doDeferredInit(WinBits nBits)
ToolBox::ToolBox( vcl::Window* pParent, WinBits nStyle ) :
DockingWindow( WINDOW_TOOLBOX )
{
+ ImplInitToolBoxData();
ImplInit( pParent, nStyle );
}
@@ -1611,6 +1619,7 @@ ToolBox::ToolBox( vcl::Window* pParent, const ResId& rResId ) :
DockingWindow( WINDOW_TOOLBOX )
{
SAL_INFO( "vcl.window", "vcl: ToolBox::ToolBox( vcl::Window* pParent, const ResId& rResId )" );
+ ImplInitToolBoxData();
rResId.SetRT( RSC_TOOLBOX );
WinBits nStyle = ImplInitRes( rResId );
@@ -1632,6 +1641,8 @@ ToolBox::ToolBox(vcl::Window* pParent, const OString& rID,
const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame)
: DockingWindow(WINDOW_TOOLBOX)
{
+ ImplInitToolBoxData();
+
loadUI(pParent, rID, rUIXMLDescription, rFrame);
// calculate size of floating windows and switch if the