Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a247ebf

Browse files
committed
Use an SVG icon for the Gtk window with pygtk >= 2.8 only, otherwise
use a PNG to avoid the memory leak in rsvg. svn path=/trunk/matplotlib/; revision=3453
1 parent b4d4aa7 commit a247ebf

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

lib/matplotlib/backends/backend_gtk.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,11 +1275,16 @@ def on_dialog_lineprops_cancelbutton_clicked(self, button):
12751275
self.dlg.hide()
12761276

12771277
# set icon used when windows are minimized
1278-
# Unfortunately, the SVG renderer (rsvg) leaks memory like a sieve,
1279-
# so we use a PNG file instead.
1278+
# Unfortunately, the SVG renderer (rsvg) leaks memory under earlier
1279+
# versions of pygtk, so we have to use a PNG file instead.
12801280
try:
1281+
1282+
if gtk.pygtk_version < (2, 8, 0):
1283+
icon_filename = 'matplotlib.png'
1284+
else:
1285+
icon_filename = 'matplotlib.svg'
12811286
gtk.window_set_default_icon_from_file (
1282-
os.path.join (matplotlib.rcParams['datapath'], 'images', 'matplotlib.png'))
1287+
os.path.join (matplotlib.rcParams['datapath'], 'images', icon_filename))
12831288
except:
12841289
verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])
12851290

0 commit comments

Comments
 (0)