Files
libreoffice/basctl/source/inc/baside3.hxx
Stephan Bergmann 637d645a34 Prevent basctl::PropBrw using basctl::Layout from within ~Layout
...as is reproducible when creating a new dialog via "Tools - Macros - Organize
Dialogs", adding e.g. some date/time controls to it, then closing LO.

Invalid read of size 8
 at 0x23DD58DB: basctl::Layout::SplittedSide::Remove(basctl::DockingWindow*) (/basctl/source/basicide/layout.cxx:205)
 by 0x23DD4F65: basctl::Layout::Remove(basctl::DockingWindow*) (/basctl/source/basicide/layout.cxx:62)
 by 0x23D847B7: basctl::DialogWindowLayout::RemovePropertyBrowser() (/basctl/source/basicide/baside3.cxx:1459)
 by 0x23E45AB3: basctl::PropBrw::~PropBrw() (/basctl/source/dlged/propbrw.cxx:202)
 by 0x23E45BA5: basctl::PropBrw::~PropBrw() (/basctl/source/dlged/propbrw.cxx:205)
 by 0x7E03A49: VCLXDevice::DestroyOutputDevice() (/toolkit/source/awt/vclxdevice.cxx:56)
 by 0x7E4655D: VCLXWindow::dispose() (/toolkit/source/awt/vclxwindow.cxx:956)
 by 0x7FD451C: UnoWrapper::WindowDestroyed(Window*) (/toolkit/source/helper/unowrapper.cxx:263)
 by 0x95EA632: Window::~Window() (/vcl/source/window/window.cxx:4365)
 by 0x23DD4EFD: basctl::Layout::~Layout() (/basctl/source/basicide/layout.cxx:56)
 by 0x23D89E39: basctl::DialogWindowLayout::~DialogWindowLayout() (in /data/lo/core/solver/unxlngx6/installation/opt/program/libbasctllo.so)
 by 0x23D89E69: basctl::DialogWindowLayout::~DialogWindowLayout() (/basctl/source/inc/baside3.hxx:125)
 ...
Address 0x19d17da0 is 0 bytes inside a block of size 80 free'd
 at 0x4A078DE: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
 by 0x23DD92D5: __gnu_cxx::new_allocator<basctl::Layout::SplittedSide::Item>::deallocate(basctl::Layout::SplittedSide::Item*, unsigned long) (/usr/include/c++/4.8.1/ext/new_allocator.h:110)
 by 0x23DD8C77: std::__cxx1998::_Vector_base<basctl::Layout::SplittedSide::Item, std::allocator<basctl::Layout::SplittedSide::Item> >::_M_deallocate(basctl::Layout::SplittedSide::Item*, unsigned long) (/usr/include/c++/4.8.1/bits/stl_vector.h:174)
 by 0x23DD7F89: std::__cxx1998::_Vector_base<basctl::Layout::SplittedSide::Item, std::allocator<basctl::Layout::SplittedSide::Item> >::~_Vector_base() (/usr/include/c++/4.8.1/bits/stl_vector.h:160)
 by 0x23DD73DC: std::__cxx1998::vector<basctl::Layout::SplittedSide::Item, std::allocator<basctl::Layout::SplittedSide::Item> >::~vector() (/usr/include/c++/4.8.1/bits/stl_vector.h:416)
 by 0x23DD6A05: std::__debug::vector<basctl::Layout::SplittedSide::Item, std::allocator<basctl::Layout::SplittedSide::Item> >::~vector() (/usr/include/c++/4.8.1/debug/vector:144)
 by 0x23DD6889: basctl::Layout::SplittedSide::~SplittedSide() (/basctl/source/basicide/layout.hxx:80)
 by 0x23DD4EF1: basctl::Layout::~Layout() (/basctl/source/basicide/layout.cxx:56)
 by 0x23D89E39: basctl::DialogWindowLayout::~DialogWindowLayout() (in /data/lo/core/solver/unxlngx6/installation/opt/program/libbasctllo.so)
 by 0x23D89E69: basctl::DialogWindowLayout::~DialogWindowLayout() (/basctl/source/inc/baside3.hxx:125)
 by 0x23D997F3: void boost::checked_delete<basctl::DialogWindowLayout>(basctl::DialogWindowLayout*) (/workdir/unxlngx6/UnpackedTarball/boost/boost/checked_delete.hpp:34)
 by 0x23D99694: boost::scoped_ptr<basctl::DialogWindowLayout>::~scoped_ptr() (/workdir/unxlngx6/UnpackedTarball/boost/boost/smart_ptr/scoped_ptr.hpp:82)
 by 0x23D9A5E7: basctl::Shell::~Shell() (/basctl/source/basicide/basidesh.cxx:223)
 by 0x23D9A717: basctl::Shell::~Shell() (/basctl/source/basicide/basidesh.cxx:248)
 by 0x6942297: SfxViewFrame::ReleaseObjectShell_Impl() (/sfx2/source/view/viewfrm.cxx:1089)
 by 0x6943BAB: SfxViewFrame::~SfxViewFrame() (/sfx2/source/view/viewfrm.cxx:1484)
 by 0x6943E09: SfxViewFrame::~SfxViewFrame() (/sfx2/source/view/viewfrm.cxx:1505)
 by 0x69427EC: SfxViewFrame::Close() (/sfx2/source/view/viewfrm.cxx:1144)
 by 0x6919441: SfxFrame::DoClose_Impl() (/sfx2/source/view/frame.cxx:175)
 by 0x6934542: SfxBaseController::dispose() (/sfx2/source/view/sfxbasecontroller.cxx:1035)
 by 0x1BC8C5B3: framework::Frame::setComponent(com::sun::uno::Reference<com::sun::awt::XWindow> const&, com::sun::uno::Reference<com::sun::frame::XController> const&) (/framework/source/services/frame.cxx:1357)
 by 0x1BBAF54B: framework::CloseDispatcher::implts_establishBackingMode() (/framework/source/dispatch/closedispatcher.cxx:540)
 by 0x1BBAEB15: framework::CloseDispatcher::impl_asyncCallback(void*) (/framework/source/dispatch/closedispatcher.cxx:391)
 by 0x1BBAE6AF: framework::CloseDispatcher::dispatchWithNotification(com::sun::util::URL const&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&, com::sun::uno::Reference<com::sun::frame::XDispatchResultListener> const&) (/framework/source/dispatch/closedispatcher.cxx:228)
 by 0x23A2A71D: framework::DispatchHelper::executeDispatch(com::sun::uno::Reference<com::sun::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) (/framework/source/services/dispatchhelper.cxx:142)
 by 0x1BC06442: framework::LayoutManager::MenuBarClose(void*) (/framework/source/layoutmanager/layoutmanager.cxx:2638)
 by 0x1BC062F6: framework::LayoutManager::LinkStubMenuBarClose(void*, void*) (/framework/source/layoutmanager/layoutmanager.cxx:2621)
 by 0x9053555: Link::Call(void*) const (/include/tools/link.hxx:123)
 by 0x9610263: ImplHandleUserEvent(ImplSVEvent*) (/vcl/source/window/winproc.cxx:1975)
 by 0x961173A: ImplWindowFrameProc(Window*, SalFrame*, unsigned short, void const*) (/vcl/source/window/winproc.cxx:2590)
 by 0x961FCAE: SalFrame::CallCallback(unsigned short, void const*) const (in /data/lo/core/solver/unxlngx6/installation/opt/program/libvcllo.so)
 by 0x961F74D: SalGenericDisplay::DispatchInternalEvent() (/vcl/generic/app/gendisp.cxx:91)
 by 0x171A5821: GtkData::userEventFn(void*) (/vcl/unx/gtk/app/gtkdata.cxx:933)
 by 0x171A587C: call_userEventFn (/vcl/unx/gtk/app/gtkdata.cxx:943)
 by 0x3B78E47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
 by 0x3B78E48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3)
 by 0x3B78E481FB: g_main_context_iteration (in /usr/lib64/libglib-2.0.so.0.3600.3)
 by 0x171A47B0: GtkData::Yield(bool, bool) (/vcl/unx/gtk/app/gtkdata.cxx:574)
 by 0x171A82BD: GtkInstance::Yield(bool, bool) (/vcl/unx/gtk/app/gtkinst.cxx:405)
 by 0x906C838: ImplYield(bool, bool) (/vcl/source/app/svapp.cxx:417)
 by 0x9068F00: Application::Yield() (/vcl/source/app/svapp.cxx:451)
 by 0x9068EB0: Application::Execute() (/vcl/source/app/svapp.cxx:396)
 by 0x4EC6117: desktop::Desktop::Main() (/desktop/source/app/app.cxx:1720)
 by 0x9075192: ImplSVMain() (/vcl/source/app/svmain.cxx:162)
 by 0x907529C: SVMain() (/vcl/source/app/svmain.cxx:198)
 by 0x4F0A9C0: soffice_main (/desktop/source/app/sofficemain.cxx:81)
 by 0x40096B: sal_main (/desktop/source/app/main.c:48)
 by 0x40094C: main (/desktop/source/app/main.c:47)

Change-Id: If7ec0fceec6da1731df8ac389406327fbd95b382
2013-08-06 12:01:28 +02:00

166 lines
5.3 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef BASCTL_BASIDE3_HXX
#define BASCTL_BASIDE3_HXX
#include "../basicide/layout.hxx"
#include "bastypes.hxx"
#include "propbrw.hxx"
#include <svl/undo.hxx>
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/fixed.hxx>
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <boost/scoped_ptr.hpp>
class Printer;
class StarBASIC;
class SfxItemSet;
class SfxUndoManager;
namespace basctl
{
class DlgEditor;
class DlgEdModel;
class DlgEdPage;
class DlgEdView;
class DialogWindowLayout;
class ObjectCatalog;
class DialogWindow: public BaseWindow
{
private:
DialogWindowLayout& rLayout;
boost::scoped_ptr<DlgEditor> pEditor; // never nullptr
boost::scoped_ptr<SfxUndoManager> pUndoMgr; // never nullptr
Link aOldNotifyUndoActionHdl;
OUString aCurPath;
protected:
virtual void Paint( const Rectangle& );
virtual void Resize();
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
virtual void MouseMove( const MouseEvent& rMEvt );
virtual void KeyInput( const KeyEvent& rKEvt );
virtual void Command( const CommandEvent& rCEvt );
virtual void LoseFocus();
DECL_LINK( NotifyUndoActionHdl, SfxUndoAction * );
virtual void DoInit();
virtual void DoScroll( ScrollBar* pCurScrollBar );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
void InitSettings(bool bFont, bool bForeground, bool bBackground);
public:
TYPEINFO();
DialogWindow (DialogWindowLayout* pParent, ScriptDocument const& rDocument, OUString aLibName, OUString aName, com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> const& xDialogModel);
DialogWindow( DialogWindow* pCurView ); // never implemented
~DialogWindow();
virtual void ExecuteCommand( SfxRequest& rReq );
virtual void GetState( SfxItemSet& );
DlgEditor& GetEditor() const { return *pEditor; }
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetDialog() const;
DlgEdModel& GetModel() const;
DlgEdPage& GetPage() const;
DlgEdView& GetView() const;
bool RenameDialog( const OUString& rNewName );
void DisableBrowser();
void UpdateBrowser();
bool SaveDialog();
bool ImportDialog();
virtual OUString GetTitle();
virtual EntryDescriptor CreateEntryDescriptor();
virtual void SetReadOnly (bool bReadOnly);
virtual bool IsReadOnly();
virtual void StoreData();
virtual bool IsModified();
virtual bool IsPasteAllowed();
virtual svl::IUndoManager* GetUndoManager();
// return number of pages to be printed
virtual sal_Int32 countPages( Printer* pPrinter );
// print page
virtual void printPage (sal_Int32 nPage, Printer*);
virtual void Activating ();
virtual void Deactivating ();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
virtual char const* GetHid () const;
virtual ItemType GetType () const;
};
//
// DialogWindowLayout
//
class DialogWindowLayout : public Layout
{
public:
DialogWindowLayout (Window* pParent, ObjectCatalog&);
~DialogWindowLayout();
public:
void ShowPropertyBrowser ();
void UpdatePropertyBrowser ();
void DisablePropertyBrowser ();
public:
// Layout:
virtual void Activating (BaseWindow&);
virtual void Deactivating ();
virtual void ExecuteGlobal (SfxRequest&);
virtual void GetState (SfxItemSet&, unsigned nWhich);
virtual void UpdateDebug (bool){};
protected:
// Layout:
virtual void OnFirstSize (long nWidth, long nHeight);
private:
// child window
DialogWindow* pChild;
// dockable windows:
// object catalog (owned by Shell)
ObjectCatalog& rObjectCatalog;
// property browser (created by this, deleted by toolkit)
PropBrw* pPropertyBrowser;
private:
void AddPropertyBrowser ();
private:
friend class DialogWindow;
};
} // namespace basctl
#endif // BASCTL_BASIDE3_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */