]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/toolbar.cpp
Applied patch [ 642157 ] [MSW] HMENU resource leak from wxMenuBar
[wxWidgets.git] / src / motif / toolbar.cpp
index 03f2e08a9e3f6cdbc8ada9fa4409b0174bf27d98..5f920cc7a1270b1780ca0b12b8d62d7b38a9011b 100644 (file)
@@ -164,9 +164,8 @@ wxToolBarTool::~wxToolBarTool()
 {
     if ( m_widget )
         XtDestroyWidget(m_widget);
-    if ( m_pixmap )
-        XmDestroyPixmap(DefaultScreenOfDisplay((Display*)wxGetDisplay()),
-                        m_pixmap);
+    // note: do not delete m_pixmap here because it will be deleted
+    //       by the base class when the bitmap is destroyed.
 }
 
 // ----------------------------------------------------------------------------
@@ -285,7 +284,10 @@ bool wxToolBar::Realize()
                 wxControl* control = tool->GetControl();
                 wxSize sz = control->GetSize();
                 wxPoint pos = control->GetPosition();
-                control->Move(currentX, pos.y);
+                // Allow a control to specify a y-offset by setting its initial position,
+                // but still don't allow it to position itself above the top margin.
+                int controlY = (pos.y > 0) ? currentY + pos.y : currentY;
+                control->Move(currentX, controlY);
                 currentX += sz.x + packing;
 
                 break;