From 7e4dd61f264a906885cde307929b300287dab8c5 Mon Sep 17 00:00:00 2001
From: Noel Grandin <noel@peralex.com>
Date: Tue, 22 Dec 2015 09:05:32 +0200
Subject: [PATCH] fix Link::operator<
so that it is consistent with operator==
plus c615943bda57eadfa73c14a7314938aabe0bd16f
and f120abb446bf3f5230ed06a3b148654dde36bb94
just in case
(cherry picked from commit 144e73f50c49333f61c6f27b882be9dbc232ceb4)
Change-Id: Ie4c68a1f02d8c298fe99e42c5854f89db79bf3bc
---
include/tools/link.hxx | 10 ++++++++--
vcl/source/control/combobox.cxx | 6 ++++++
vcl/source/control/lstbox.cxx | 2 ++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/include/tools/link.hxx b/include/tools/link.hxx
index fa86e5d..a3ad0c3 100644
--- a/include/tools/link.hxx
+++ b/include/tools/link.hxx
@@ -131,8 +131,14 @@ public:
bool operator !() const { return !IsSet(); }
bool operator <(Link const & other) const {
- return reinterpret_cast<sal_uIntPtr>(function_)
- < reinterpret_cast<sal_uIntPtr>(other.function_);
+ sal_uIntPtr ptr1 = reinterpret_cast<sal_uIntPtr>(function_);
+ sal_uIntPtr ptr2 = reinterpret_cast<sal_uIntPtr>(other.function_);
+ if (ptr1 < ptr2)
+ return true;
+ else if (ptr1 > ptr2)
+ return false;
+ else
+ return instance_ < other.instance_;
};
bool operator ==(Link const & other) const
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 19c95e7..9e05a69 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -953,11 +953,15 @@ OUString ComboBox::GetEntry( sal_Int32 nPos ) const
sal_Int32 ComboBox::GetEntryCount() const
{
+ if (!mpImplLB)
+ return 0;
return mpImplLB->GetEntryList()->GetEntryCount() - mpImplLB->GetEntryList()->GetMRUCount();
}
bool ComboBox::IsTravelSelect() const
{
+ if (!mpImplLB)
+ return false;
return mpImplLB->IsTravelSelect();
}
@@ -974,6 +978,8 @@ void ComboBox::EnableMultiSelection( bool bMulti )
bool ComboBox::IsMultiSelectionEnabled() const
{
+ if (!mpImplLB)
+ return false;
return mpImplLB->IsMultiSelectionEnabled();
}
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 1b0943b..8c701c7 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1215,6 +1215,8 @@ void ListBox::EnableMultiSelection( bool bMulti, bool bStackSelection )
bool ListBox::IsMultiSelectionEnabled() const
{
+ if (!mpImplLB)
+ return false;
return mpImplLB->IsMultiSelectionEnabled();
}
--
2.9.3