summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-10-15 13:09:54 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-10-15 13:19:02 +0100
commit4421bb8eb51868cfd2d122e198382e605b370ef2 (patch)
treee41dc83b6c0455bd36c6e746b2c0d70d060cd24e /vcl
parent6cd11e4f0cd030243485e27c594c2bb04f0820ed (diff)
tdf#94495 - protect lstbox usage post-dispose, and fix ItemWin focus.
Change-Id: I2e4d1c79f57ec048d66111ed393491b7803ee3b9
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/lstbox.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index b2998cac4051..cf1230b154c7 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -971,6 +971,8 @@ void ListBox::DoubleClick()
void ListBox::Clear()
{
+ if (!mpImplLB)
+ return;
mpImplLB->Clear();
if( IsDropDownBox() )
{
@@ -1026,13 +1028,15 @@ void ListBox::RemoveEntry( sal_Int32 nPos )
Image ListBox::GetEntryImage( sal_Int32 nPos ) const
{
- if ( mpImplLB->GetEntryList()->HasEntryImage( nPos ) )
+ if ( mpImplLB && mpImplLB->GetEntryList()->HasEntryImage( nPos ) )
return mpImplLB->GetEntryList()->GetEntryImage( nPos );
return Image();
}
sal_Int32 ListBox::GetEntryPos( const OUString& rStr ) const
{
+ if (!mpImplLB)
+ return LISTBOX_ENTRY_NOTFOUND;
sal_Int32 nPos = mpImplLB->GetEntryList()->FindEntry( rStr );
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
nPos = nPos - mpImplLB->GetEntryList()->GetMRUCount();
@@ -1041,6 +1045,8 @@ sal_Int32 ListBox::GetEntryPos( const OUString& rStr ) const
sal_Int32 ListBox::GetEntryPos( const void* pData ) const
{
+ if (!mpImplLB)
+ return LISTBOX_ENTRY_NOTFOUND;
sal_Int32 nPos = mpImplLB->GetEntryList()->FindEntry( pData );
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
nPos = nPos - mpImplLB->GetEntryList()->GetMRUCount();
@@ -1049,11 +1055,15 @@ sal_Int32 ListBox::GetEntryPos( const void* pData ) const
OUString ListBox::GetEntry( sal_Int32 nPos ) const
{
+ if (!mpImplLB)
+ return OUString();
return mpImplLB->GetEntryList()->GetEntryText( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
}
sal_Int32 ListBox::GetEntryCount() const
{
+ if (!mpImplLB)
+ return 0;
return mpImplLB->GetEntryList()->GetEntryCount() - mpImplLB->GetEntryList()->GetMRUCount();
}
@@ -1064,11 +1074,16 @@ OUString ListBox::GetSelectEntry(sal_Int32 nIndex) const
sal_Int32 ListBox::GetSelectEntryCount() const
{
+ if (!mpImplLB)
+ return 0;
return mpImplLB->GetEntryList()->GetSelectEntryCount();
}
sal_Int32 ListBox::GetSelectEntryPos( sal_Int32 nIndex ) const
{
+ if (!mpImplLB || !mpImplLB->GetEntryList())
+ return LISTBOX_ENTRY_NOTFOUND;
+
sal_Int32 nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( nIndex );
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{
@@ -1096,6 +1111,9 @@ void ListBox::SelectEntry( const OUString& rStr, bool bSelect )
void ListBox::SelectEntryPos( sal_Int32 nPos, bool bSelect )
{
+ if (!mpImplLB)
+ return;
+
if ( 0 <= nPos && nPos < mpImplLB->GetEntryList()->GetEntryCount() )
{
sal_Int32 oldSelectCount = GetSelectEntryCount(), newSelectCount = 0, nCurrentPos = mpImplLB->GetCurrentPos();