Repository navigation
Commit 5bbe88a
src: make an IBusText own an updated IBusAttrList reference
For all usages of IBusAttrList, the list is an owned reference within a
IBusText struct. `ibus_panel_convert_text()` and
`ibus_input_context_convert_text()` violate the invarient by assigning a
**floating** IBusAttrList reference to anIBusText without sinking it.
When GJS attempts to create a JS representation of an existing GObject,
it unconditionally sinks the incoming reference.[1] For a non-floating
reference this up-refs the object.
For this floating IBusAttrLit, `g_object_ref_sink` converts it to a
strong reference in-place leaving ref-count at 1. At this point the
`IBusAttrList` is referenced by both the enclosing `IBusText` and the
newly created GJS wrapper. When one of them is ref-downed the object
is recycled, leaving the other reference dangling.
To fix this we just need to maintain the list as a non-floating ref.
We already have a `ibus_text_set_attributes()` that does the intended
ref sinking, so just use that instead of manually assigning pointers.
[1]: https://gitlab.gnome.org/GNOME/gjs/-/blob/db450465ab0161e131a92992c2509507aa6152aa/gi/object.cpp#L3597
Closes: #28891 parent 526e509 commit 5bbe88a
2 files changed
Lines changed: 8 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
| 572 | + | |
| 573 | + | |
576 | 574 | | |
577 | 575 | | |
578 | 576 | | |
| |||
581 | 579 | | |
582 | 580 | | |
583 | 581 | | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
| 582 | + | |
| 583 | + | |
588 | 584 | | |
589 | 585 | | |
590 | 586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1203 | 1203 | | |
1204 | 1204 | | |
1205 | 1205 | | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
| 1206 | + | |
| 1207 | + | |
1210 | 1208 | | |
1211 | 1209 | | |
1212 | 1210 | | |
| |||
1215 | 1213 | | |
1216 | 1214 | | |
1217 | 1215 | | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
| 1216 | + | |
| 1217 | + | |
1222 | 1218 | | |
1223 | 1219 | | |
1224 | 1220 | | |
| |||
0 commit comments