[Libreoffice-commits] core.git: vcl/unx

Michael Stahl mstahl at redhat.com
Wed Jun 29 11:11:50 UTC 2016


 vcl/unx/gtk/gtksys.cxx |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit e2b267b1906817cc45f0e4896bed58cff5b6b0f9
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jun 29 13:06:41 2016 +0200

    vcl: GTK: fix libstdc++ "irreflexive" assert
    
    /usr/include/c++/6.1.1/bits/stl_algo.h:4737:
    Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).
    
    GdkRectangleCoincident is clearly not a less-than operator as required
    for std::sort.
    
    Change-Id: If2e65d420dc8cdf0707081361a40d4eaea28424e

diff --git a/vcl/unx/gtk/gtksys.cxx b/vcl/unx/gtk/gtksys.cxx
index ac24256..80831d6 100644
--- a/vcl/unx/gtk/gtksys.cxx
+++ b/vcl/unx/gtk/gtksys.cxx
@@ -62,6 +62,17 @@ GtkSalSystem::GetDisplayXScreenCount()
 namespace
 {
 
+struct GdkRectangleCoincidentLess
+{
+    // fdo#78799 - detect and elide overlaying monitors of different sizes
+    bool operator()(GdkRectangle const& rLeft, GdkRectangle const& rRight)
+    {
+        return
+            rLeft.x < rRight.x
+            || rLeft.y < rRight.y
+            ;
+    }
+};
 struct GdkRectangleCoincident
 {
     // fdo#78799 - detect and elide overlaying monitors of different sizes
@@ -101,10 +112,11 @@ GtkSalSystem::countScreenMonitors()
                 gdk_screen_get_monitor_geometry(pScreen, j, &aGeometry);
                 aGeometries.push_back(aGeometry);
             }
-            GdkRectangleCoincident aCmp;
-            std::sort(aGeometries.begin(), aGeometries.end(), aCmp);
+            std::sort(aGeometries.begin(), aGeometries.end(),
+                    GdkRectangleCoincidentLess());
             const std::vector<GdkRectangle>::iterator aUniqueEnd(
-                    std::unique(aGeometries.begin(), aGeometries.end(), aCmp));
+                    std::unique(aGeometries.begin(), aGeometries.end(),
+                    GdkRectangleCoincident()));
             nMonitors = std::distance(aGeometries.begin(), aUniqueEnd);
         }
         maScreenMonitors.push_back(std::make_pair(pScreen, nMonitors));


More information about the Libreoffice-commits mailing list