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