Skip to content
This repository
Browse code

Merge pull request #3188 from popcornmix/sort_crash

[settings] Fix memory corruption caused by resolution sorting
  • Loading branch information...
commit faca7b89054fe64a2d58f24a1bd90c832f666a39 2 parents dfe0f54 + 238c867
Sascha Montellese authored September 03, 2013

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  xbmc/windowing/WinSystem.cpp
4  xbmc/windowing/WinSystem.cpp
@@ -149,9 +149,11 @@ static void AddResolution(vector<RESOLUTION_WHR> &resolutions, unsigned int addi
149 149
 
150 150
 static bool resSortPredicate(RESOLUTION_WHR i, RESOLUTION_WHR j)
151 151
 {
  152
+  // note: this comparison must obey "strict weak ordering"
  153
+  // a "!=" on the flags comparison resulted in memory corruption
152 154
   return (    i.width < j.width
153 155
           || (i.width == j.width && i.height < j.height)
154  
-          || (i.width == j.width && i.height == j.height && i.flags != j.flags) );
  156
+          || (i.width == j.width && i.height == j.height && i.flags < j.flags) );
155 157
 }
156 158
 
157 159
 vector<RESOLUTION_WHR> CWinSystemBase::ScreenResolutions(int screen, float refreshrate)

0 notes on commit faca7b8

Please sign in to comment.
Something went wrong with that request. Please try again.