[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).
|
import gi # isort:skip (Version check required before import).
|
||||||
|
|
||||||
gi.require_version('PangoCairo', '1.0') # NOQA: E402
|
gi.require_version('PangoCairo', '1.0') # NOQA: E402
|
||||||
|
gi.require_foreign('cairo') # NOQA: E402
|
||||||
gi.require_version('cairo', '1.0') # NOQA: E402
|
gi.require_version('cairo', '1.0') # NOQA: E402
|
||||||
|
|
||||||
# isort:imports-thirdparty
|
# isort:imports-thirdparty
|
||||||
|
@ -38,7 +39,8 @@ class PiecesBar(DrawingArea):
|
||||||
# Get progress bar styles, in order to keep font consistency
|
# Get progress bar styles, in order to keep font consistency
|
||||||
pb = ProgressBar()
|
pb = ProgressBar()
|
||||||
pb_style = pb.get_style_context()
|
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)
|
self.text_font.set_weight(Weight.BOLD)
|
||||||
# Done with the ProgressBar styles, don't keep refs of it
|
# Done with the ProgressBar styles, don't keep refs of it
|
||||||
del pb, pb_style
|
del pb, pb_style
|
||||||
|
|
Loading…
Reference in New Issue