Skip to content

Commit

Permalink
icons: avoid memoization for icon paths
Browse files Browse the repository at this point in the history
The icon paths might incur unicode serialization, so avoid the issue by
not memoizing icons.

There performance difference is minimal.

Resolves: #991
Reported-by: Aleksey @akontsevich on github.com
Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information
davvid committed Sep 11, 2019
1 parent e0daf9c commit 0e6c2ab
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 0 additions & 3 deletions cola/icons.py
Expand Up @@ -10,7 +10,6 @@
from . import qtcompat
from . import resources
from .compat import ustr
from .decorators import memoize
from .i18n import N_


Expand Down Expand Up @@ -67,7 +66,6 @@ def name_from_basename(basename):
return 'icons:' + basename


@memoize
def from_name(name):
"""Return a QIcon from an absolute filename or "icons:basename.svg" name"""
return QtGui.QIcon(name)
Expand All @@ -78,7 +76,6 @@ def icon(basename):
return from_name(name_from_basename(basename))


@memoize
def from_theme(name, fallback=None):
"""Grab an icon from the current theme with a fallback
Expand Down
1 change: 1 addition & 0 deletions share/doc/git-cola/relnotes.rst
Expand Up @@ -60,6 +60,7 @@ Fixes

* Better unicode robustness.
(`#990 <https://github.com/git-cola/git-cola/issues/990>`_)
(`#910 <https://github.com/git-cola/git-cola/issues/991>`_)

* The "Branches" widget did not always update itself when deleting branches
(for example, when inotify is disabled or unavailable).
Expand Down

0 comments on commit 0e6c2ab

Please sign in to comment.