zlgopen / awtk

AWTK = Toolkit AnyWhere(a cross-platform embedded GUI)
GNU Lesser General Public License v2.1
3.12k stars 771 forks source link

tk_choose_file 函数的返回值无法访问 #916

Open Gravity-of-eath opened 1 day ago

Gravity-of-eath commented 1 day ago

这个GDB的调用栈

0 __strcpy_avx2 () at ../sysdeps/x86_64/multiarch/strcpy-avx2.S:301

1 0x00007ffff7baa9a4 in tk_strcpy (dst=0x55555555a040 "", src=0x56bdfe20 <error: Cannot access memory at address 0x56bdfe20>) at src/tkc/utils.c:310

2 0x0000555555556d25 in on_open_click (ctx=0x555555e987c0, e=0x7fffffffcea0) at src/pages/home_page.c:24

3 0x00007ffff7b76fbc in emitter_dispatch (emitter=0x555555e08860, e=0x7fffffffcea0) at src/tkc/emitter.c:131

4 0x00007ffff7a45ecb in widget_dispatch (widget=0x555555e29730, e=0x7fffffffcea0) at src/base/widget.c:1367

5 0x00007ffff79d1c0b in button_on_event (widget=0x555555e29730, e=0x7fffffffd3a0) at src/widgets/button.c:246

6 0x00007ffff7a45e68 in widget_dispatch (widget=0x555555e29730, e=0x7fffffffd3a0) at src/base/widget.c:1357

7 0x00007ffff7a4df13 in widget_on_pointer_up_after_children (widget=0x555555e29730, e=0x7fffffffd3a0) at src/base/widget.c:3240

8 0x00007ffff7a4e0dd in widget_on_pointer_up_impl (widget=0x555555e29730, e=0x7fffffffd3a0) at src/base/widget.c:3262

9 0x00007ffff7a4e17b in widget_on_pointer_up (widget=0x555555e29730, e=0x7fffffffd3a0) at src/base/widget.c:3271

10 0x00007ffff7a4dedd in widget_on_pointer_up_children (widget=0x555555e83020, e=0x7fffffffd3a0) at src/base/widget.c:3231

11 0x00007ffff7a4e06d in widget_on_pointer_up_impl (widget=0x555555e83020, e=0x7fffffffd3a0) at src/base/widget.c:3253

12 0x00007ffff7a4e17b in widget_on_pointer_up (widget=0x555555e83020, e=0x7fffffffd3a0) at src/base/widget.c:3271

13 0x00007ffff7a4dedd in widget_on_pointer_up_children (widget=0x555555e987c0, e=0x7fffffffd3a0) at src/base/widget.c:3231

14 0x00007ffff7a4e06d in widget_on_pointer_up_impl (widget=0x555555e987c0, e=0x7fffffffd3a0) at src/base/widget.c:3253

15 0x00007ffff7a4e17b in widget_on_pointer_up (widget=0x555555e987c0, e=0x7fffffffd3a0) at src/base/widget.c:3271

16 0x00007ffff7a4dedd in widget_on_pointer_up_children (widget=0x55555557e220, e=0x7fffffffd3a0) at src/base/widget.c:3231

--Type for more, q to quit, c to continue without paging--Quit

xianjimli commented 20 hours ago

我写了一个demo没发现问题,用valgrind也没有查出内存问题: https://github.com/zlgopen/awtk-c-demos/blob/master/demos/file_pick.c