summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/control
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-12-20 21:29:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-12-21 13:17:24 +0100
commitb2e7e5ac8d511ada9e254d86b2f16509d4b9b977 (patch)
treea6b009bd04fa1656b61ee9c03949a55469a7238d /dbaccess/source/ui/control
parent93d1d7b0b600d021ccbb2169b4bb4bacca44dd30 (diff)
tdf#122020 crash in SvTreeList::InvalidateEntry
a PostUserEvent of DBTreeListBox::OnResetEntry with a SvTreeListEntry* pEntry as payload, then the DBTreeListBox is disposed and then the UserEvent arrives and the, by now deleted, pEntry is processed by the disposed DBTreeListBox Change-Id: I951639eb633920aa3536cd44320f36f6b2e910aa Reviewed-on: https://gerrit.libreoffice.org/65512 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source/ui/control')
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 03b87a1b2517..2edbd0f6195a 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -59,7 +59,8 @@ DBTreeListBox::DBTreeListBox( vcl::Window* pParent, WinBits nWinStyle )
:SvTreeListBox(pParent,nWinStyle)
,m_pDragedEntry(nullptr)
,m_pActionListener(nullptr)
- ,m_pContextMenuProvider( nullptr )
+ ,m_pContextMenuProvider(nullptr)
+ ,m_pResetEvent(nullptr)
{
init();
}
@@ -89,6 +90,11 @@ DBTreeListBox::~DBTreeListBox()
void DBTreeListBox::dispose()
{
+ if (m_pResetEvent)
+ {
+ RemoveUserEvent(m_pResetEvent);
+ m_pResetEvent = nullptr;
+ }
implStopSelectionTimer();
SvTreeListBox::dispose();
}
@@ -119,11 +125,6 @@ SvTreeListEntry* DBTreeListBox::GetEntryPosByName( const OUString& aName, SvTree
return pEntry;
}
-void DBTreeListBox::EnableExpandHandler(SvTreeListEntry* _pEntry)
-{
- LINK(this, DBTreeListBox, OnResetEntry).Call(_pEntry);
-}
-
void DBTreeListBox::RequestingChildren( SvTreeListEntry* pParent )
{
if (m_aPreExpandHandler.IsSet() && !m_aPreExpandHandler.Call(pParent))
@@ -131,7 +132,7 @@ void DBTreeListBox::RequestingChildren( SvTreeListEntry* pParent )
// an error occurred. The method calling us will reset the entry flags, so it can't be expanded again.
// But we want that the user may do a second try (i.e. because he mistypes a password in this try), so
// we have to reset these flags controlling the expand ability
- PostUserEvent(LINK(this, DBTreeListBox, OnResetEntry), pParent, true);
+ m_pResetEvent = PostUserEvent(LINK(this, DBTreeListBox, OnResetEntryHdl), pParent, true);
}
}
@@ -177,9 +178,8 @@ void DBTreeListBox::MouseButtonDown( const MouseEvent& rMEvt )
SvTreeListBox::MouseButtonDown(rMEvt);
}
-IMPL_LINK(DBTreeListBox, OnResetEntry, void*, p, void)
+void DBTreeListBox::EnableExpandHandler(SvTreeListEntry* pEntry)
{
- SvTreeListEntry* pEntry = static_cast<SvTreeListEntry*>(p);
// set the flag which allows if the entry can be expanded
pEntry->SetFlags( (pEntry->GetFlags() & ~SvTLEntryFlags(SvTLEntryFlags::NO_NODEBMP | SvTLEntryFlags::HAD_CHILDREN)) | SvTLEntryFlags::CHILDREN_ON_DEMAND );
// redraw the entry
@@ -188,6 +188,12 @@ IMPL_LINK(DBTreeListBox, OnResetEntry, void*, p, void)
myModel->InvalidateEntry( pEntry );
}
+IMPL_LINK(DBTreeListBox, OnResetEntryHdl, void*, p, void)
+{
+ m_pResetEvent = nullptr;
+ EnableExpandHandler(static_cast<SvTreeListEntry*>(p));
+}
+
void DBTreeListBox::ModelHasEntryInvalidated( SvTreeListEntry* _pEntry )
{
SvTreeListBox::ModelHasEntryInvalidated( _pEntry );