my application have ,many layer win when i click the mouse‘s ’ right button i want to get the top
win and close it
What MCU/Processor/Board and compiler are you using?
HiSilicon ARM
What do you want to achieve?
i want to get the top
win and close it
What have you tried so far?
i try to use lv_obj_get_child(lv_disp_get_scr_act(NULL),NULL); to get the top win but its failed
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/*You code here*/
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.
This has a flaw. You have set topwin to the address of the active screen, but then you are getting the title of the window pointed to by topwinp which was never initialized. You are trying to access a pointer which has an undefined value, thus the segfault.
It’s likely that topwin is not actually pointing to a window object like you think. Can you try printing the value of buf.type[0] after a call to lv_obj_get_type(topwin)?
Is there a reason why you retrieve the top window through lv_obj_get_child(lv_disp_get_scr_act(NULL),NULL), rather than just updating the value of topwin when it is created? What you are doing here seems a bit awkward.