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