Fix unbound (and unnecessary) icon cache recursion on theme icon lookup (Qt client) (#2292)
* Avoid infinite recursion if icon is missing (Qt client) * Fix recently-introduced clang-tidy warnings (Qt client) Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
f39a1e45a8
commit
e590b1cd37
|
@ -227,13 +227,13 @@ QIcon IconCache::getThemeIcon(
|
|||
QString const& fallbackName,
|
||||
std::optional<QStyle::StandardPixmap> const& fallbackPixmap) const
|
||||
{
|
||||
static auto const rtlSuffix = qApp->layoutDirection() == Qt::RightToLeft ? QStringLiteral("-rtl") : QString();
|
||||
static auto const RtlSuffix = qApp->layoutDirection() == Qt::RightToLeft ? QStringLiteral("-rtl") : QString();
|
||||
|
||||
auto icon = QIcon::fromTheme(name + rtlSuffix);
|
||||
auto icon = QIcon::fromTheme(name + RtlSuffix);
|
||||
|
||||
if (icon.isNull())
|
||||
{
|
||||
icon = getThemeIcon(fallbackName + rtlSuffix);
|
||||
icon = QIcon::fromTheme(fallbackName + RtlSuffix);
|
||||
}
|
||||
|
||||
if (icon.isNull() && fallbackPixmap.has_value())
|
||||
|
|
|
@ -180,7 +180,7 @@ MainWindow::MainWindow(Session& session, Prefs& prefs, TorrentModel& model, bool
|
|||
ui_.optionsButton->setIcon(icons.getThemeIcon(QStringLiteral("preferences-other")));
|
||||
ui_.statsModeButton->setIcon(icons.getThemeIcon(QStringLiteral("view-statistics")));
|
||||
|
||||
auto make_network_pixmap = [this, &icons](QString name, QSize size = { 16, 16 })
|
||||
auto make_network_pixmap = [&icons](QString name, QSize size = { 16, 16 })
|
||||
{
|
||||
return icons.getThemeIcon(name, QStyle::SP_DriveNetIcon).pixmap(size);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue