[GTKUI] Fix piecesbar crashing when enabled
When enabled in preferences the piecesbar was crashing the application. This was narrowed down to an issue with text_font property and there was a suggestion that the PangoFontDescription should be freed after getting the result from get_style_context. Fixed by creating a copy of the PangoFontDescription Refs: * https://trac.wxwidgets.org/ticket/15697#comment:1
This commit is contained in:
parent
88fc21e993
commit
9c3982d4ff
|
@ -14,6 +14,7 @@ from math import pi
|
|||
import gi # isort:skip (Version check required before import).
|
||||
|
||||
gi.require_version('PangoCairo', '1.0') # NOQA: E402
|
||||
gi.require_foreign('cairo') # NOQA: E402
|
||||
gi.require_version('cairo', '1.0') # NOQA: E402
|
||||
|
||||
# isort:imports-thirdparty
|
||||
|
@ -38,7 +39,8 @@ class PiecesBar(DrawingArea):
|
|||
# Get progress bar styles, in order to keep font consistency
|
||||
pb = ProgressBar()
|
||||
pb_style = pb.get_style_context()
|
||||
self.text_font = pb_style.get_property('font', StateFlags.NORMAL)
|
||||
# Get a copy of Pango.FontDescription since original needs freed.
|
||||
self.text_font = pb_style.get_property('font', StateFlags.NORMAL).copy()
|
||||
self.text_font.set_weight(Weight.BOLD)
|
||||
# Done with the ProgressBar styles, don't keep refs of it
|
||||
del pb, pb_style
|
||||
|
|
Loading…
Reference in New Issue