(Gitter message)
This crashes at the button click on Linux/GTK, when run from console-view or compiled with -r:
Red [Needs: 'View]
metrics-font: make font! []
styles: [
panel-widget: [
default-actor: on-down
template: [
type: 'panel
pane: copy []
actors: [
on-create: func [face [object!] event [event! none!]] [
append face/pane make face! [
type: 'field
font: (metrics-font)
parent: face
]
]
]
]
]
]
window: layout/styles [
panel [
panel-widget
button "CLICK ME" [
print "OK?"
make metrics-font [style: 'bold]
print "OK!"
]
]
] styles
view/flags window ['resize]
I get various error messages. The ones I noticed were:
free(): invalid pointer
[1] 5197 abort (core dumped)
munmap_chunk(): invalid pointer
[1] 5138 abort (core dumped)
double free or corruption (out)
[1] 5270 abort (core dumped)
*** Runtime Error 1: access violation
*** Cannot determine source file/line info.
***
Platform version
Red 0.6.4 for Linux built 23-Jan-2020/16:19:08+01:00 (GTK branch)
90% of the code is not related to the issue at hand.
view/no-wait [f: field font-size 1] make f/font [size: 1]
you need use make font like this: make f/font [state: none size: 1], because two font! use one font handle! in font/state, the new font copy the old font's state.
when the new one release the handle, the old font don't known, and it also release it, it will lead to unpredictable results.
processing flow:
make f/font [size: 1], copy the state of the old font to new font (notes: new one will have a copy of handle!)make font! spec not empty, so it will trigger on-change*, then call system/view/platform/update-fontupdate-font in font.reds, so first release the copy of handle!, then replace it with a new onechange-font, the old font's handle! also will be released, then replace it with a new one.another case view [x: button "x" font-size 15 y: button "y" font x/font [y/font/size: y/font/size + 1]], but can't bypass it using state: none.
Most helpful comment
90% of the code is not related to the issue at hand.