mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
[i18n] Fix segfault on destroy on Linux
Forgot to intern the section string in QT TS loader.
This commit is contained in:
@@ -163,9 +163,13 @@ get_by_slot :: proc{get_by_slot_single_section, get_by_slot_by_section}
|
|||||||
- destroy(), to clean up the currently active catalog catalog i18n.ACTIVE
|
- destroy(), to clean up the currently active catalog catalog i18n.ACTIVE
|
||||||
- destroy(catalog), to clean up a specific catalog.
|
- destroy(catalog), to clean up a specific catalog.
|
||||||
*/
|
*/
|
||||||
destroy :: proc(catalog: ^Translation = ACTIVE) {
|
destroy :: proc(catalog: ^Translation = ACTIVE, allocator := context.allocator) {
|
||||||
if catalog != nil {
|
context.allocator = allocator
|
||||||
strings.intern_destroy(&catalog.intern)
|
|
||||||
|
if catalog == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for section in &catalog.k_v {
|
for section in &catalog.k_v {
|
||||||
for key in &catalog.k_v[section] {
|
for key in &catalog.k_v[section] {
|
||||||
delete(catalog.k_v[section][key])
|
delete(catalog.k_v[section][key])
|
||||||
@@ -173,6 +177,6 @@ destroy :: proc(catalog: ^Translation = ACTIVE) {
|
|||||||
delete(catalog.k_v[section])
|
delete(catalog.k_v[section])
|
||||||
}
|
}
|
||||||
delete(catalog.k_v)
|
delete(catalog.k_v)
|
||||||
|
strings.intern_destroy(&catalog.intern)
|
||||||
free(catalog)
|
free(catalog)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,10 @@ parse_qt_linguist_from_slice :: proc(data: []u8, options := DEFAULT_PARSE_OPTION
|
|||||||
return translation, .TS_File_Expected_Context_Name,
|
return translation, .TS_File_Expected_Context_Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
section_name := "" if options.merge_sections else ts.elements[section_name_id].value
|
section_name := strings.intern_get(&translation.intern, "")
|
||||||
|
if !options.merge_sections {
|
||||||
|
section_name = strings.intern_get(&translation.intern, ts.elements[section_name_id].value)
|
||||||
|
}
|
||||||
|
|
||||||
if section_name not_in translation.k_v {
|
if section_name not_in translation.k_v {
|
||||||
translation.k_v[section_name] = {}
|
translation.k_v[section_name] = {}
|
||||||
|
|||||||
@@ -18,5 +18,5 @@
|
|||||||
<numerusform>%d appels</numerusform>
|
<numerusform>%d appels</numerusform>
|
||||||
</translation>
|
</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|||||||
Reference in New Issue
Block a user