Guix text_button 设置文字,报错 0x30

需求 需要设置 text_button 上面显示的文字的时候,报错 "GX_SYSTEM_MEMORY_ERROR : (0x30) 未定义内存分配器或内存分配失败。" 解决 分析 debug 仔细追查,发现 _gx_text_button_text_set_ext 这个函数里面会判断有没有设置 private text copy, 如果设置了,那么再检查有没有开启 _gx_system_memory_allocator, 如果没有,那么就会报错 0x30 了。 解决方法 有两种解决方法: 无 private text copy + 无 gx_system_memory_allocator_set(memory_allocate, memory_free), 会直接使用传入进去的字符串参数,只要传入进去的不是局部变量,就没有必要勾选 private text copy. 有 private text copy + 有 gx_system_memory_allocator_set(memory_allocate, memory_free), 也可以,会多复制一份数据。 参考 第 4 章 - GUIX 服务说明 {ThreadX全家桶} GUIX sample 错误–>gx_prompt_text_set_ext大坑,必须正确指定有效字符串长度才可以使用

2023-11-30 · 1 min · 56 words · RamLife