summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2020-04-23 19:05:54 -0400
committerJoseph Donofry <joedonofry@gmail.com>2020-04-23 19:05:54 -0400
commit87c06f0fc9098831b80830bc69b230da379a498d (patch)
tree7024eb9c93f644ed91d1a0df3537ec646e06f0e3
parent994edb836c0e812933cabf5e0b57f2f8aaaba9a7 (diff)
parent69b0b68f92f2589eab86970ffc76d727e6c7738e (diff)
Merge branch 'decrypt-sidebar' of ssh://github.com/Nheko-Reborn/nheko into decrypt-sidebar
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/Utils.cpp6
2 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 779d5df6..59e6351f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@
- Fix Binding restorMode flooding logs on Qt 5.14.2+
- Fix with some qml styles hidden menu items leave empty space
- Fix encrypted messages not showing a user in the sidebar
+- Fix hangs when generating colors with some system theme color schemes (#172)
## [0.7.0] -- 2020-04-19
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 46472401..cd615c24 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -541,6 +541,7 @@ utils::generateContrastingHexColor(const QString &input, const QString &backgrou
// If the contrast doesn't meet our criteria,
// try again and again until they do by modifying first
// the lightness and then the saturation of the color.
+ int iterationCount = 9;
while (contrast < 5) {
// if our lightness is at it's bounds, try changing
// saturation instead.
@@ -587,6 +588,11 @@ utils::generateContrastingHexColor(const QString &input, const QString &backgrou
}
}
}
+
+ // don't loop forever, just give up at some point!
+ // Someone smart may find a better solution
+ if (--iterationCount < 0)
+ break;
}
// get the hex value of the generated color.