[Libreoffice-commits] .: 3 commits - svtools/inc svtools/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Oct 31 13:00:23 PDT 2012
svtools/inc/svtools/treelist.hxx | 3 +++
svtools/inc/svtools/treelistbox.hxx | 2 +-
svtools/source/contnr/treelist.cxx | 13 ++++++++-----
3 files changed, 12 insertions(+), 6 deletions(-)
New commits:
commit ddd44eb48fa03ea36fe32a3f7c9023828c1e449c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Oct 31 15:57:48 2012 -0400
fdo#56617: Fix crash on closing beanshell dialog and the macro window.
When removing an entry from the tree list, we need to
1) first remove the entry from the list,
2) broadcast its removal with the entry instance, then
3) finally delete the entry itself at the very end.
in this exact order, or else interesting stuff would ensue.
Change-Id: If42b141921ffe4ed36dce31f93a4a084204815bf
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index ea451b6..675c019 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -1232,7 +1232,9 @@ bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
SvTreeListEntries& rList = pParent->maChildren;
bool bLastEntry = false;
- Broadcast(LISTACTION_REMOVED, const_cast<SvTreeListEntry*>(pEntry));
+ // Since we need the live instance of SvTreeListEntry for broadcasting,
+ // we first need to pop it from the container, broadcast it, then delete
+ // the instance manually at the end.
if ( pEntry->HasChildListPos() )
{
@@ -1240,22 +1242,23 @@ bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
bLastEntry = (nListPos == (rList.size()-1)) ? true : false;
SvTreeListEntries::iterator it = rList.begin();
std::advance(it, nListPos);
- rList.erase(it);
+ rList.release(it).release();
}
else
{
SvTreeListEntries::iterator it =
std::find_if(rList.begin(), rList.end(), FindByPointer(pEntry));
if (it != rList.end())
- rList.erase(it);
+ rList.release(it).release();
}
- // moved to end of method because it is used later with Broadcast
-
if (!rList.empty() && !bLastEntry)
SetListPositions(rList);
nEntryCount -= nRemoved;
+ Broadcast(LISTACTION_REMOVED, const_cast<SvTreeListEntry*>(pEntry));
+ delete pEntry;
+
return true;
}
commit 2de94dfb1961b14c0f7389134c8866c833c28eca
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Oct 31 14:54:40 2012 -0400
This destructor should be virtual.
Change-Id: I48cd5988056c8dee10241d5ba3b469ae7e5191b9
diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx
index 48ab007..59b13be 100644
--- a/svtools/inc/svtools/treelistbox.hxx
+++ b/svtools/inc/svtools/treelistbox.hxx
@@ -371,7 +371,7 @@ public:
SvTreeListBox( Window* pParent, WinBits nWinStyle=0 );
SvTreeListBox( Window* pParent, const ResId& rResId );
- ~SvTreeListBox();
+ virtual ~SvTreeListBox();
SvTreeList* GetModel() const { return (SvTreeList*)pModel; }
using SvListView::SetModel;
commit b4599944f2743b9f82c9ef09e28a84b4004ab3c8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Oct 31 13:36:29 2012 -0400
Make SvTreeList non-copyable.
Change-Id: I9bb589e8a349a1404f9c09a60a82e824918744fa
diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx
index 9b96506..1473dff 100644
--- a/svtools/inc/svtools/treelist.hxx
+++ b/svtools/inc/svtools/treelist.hxx
@@ -191,6 +191,9 @@ class SVT_DLLPUBLIC SvTreeList
SVT_DLLPRIVATE void ResortChildren( SvTreeListEntry* pParent );
+ SvTreeList(const SvTreeList&); // disabled
+ SvTreeList& operator= (const SvTreeList&); // disabled
+
protected:
SvTreeListEntry* pRootItem;
More information about the Libreoffice-commits
mailing list