Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

laWidget_Delete doesn't work & causes reset #3

Open
LuisCRSousa opened this issue Oct 17, 2019 · 5 comments
Open

laWidget_Delete doesn't work & causes reset #3

LuisCRSousa opened this issue Oct 17, 2019 · 5 comments

Comments

@LuisCRSousa
Copy link

LuisCRSousa commented Oct 17, 2019

I've tried laWidget_Delete and laWidget_DeleteAllDescendants and it all causes system reset.

I've tried to debug and it seems libaria tries to paint the object again after released his memory. - Not sure

Call stack:
runtime exception @ pc address 0x9d02d968 function and line number unavailable

@LuisCRSousa
Copy link
Author

This issue is still present

@LuisCRSousa
Copy link
Author

It only works if I call laWidget_RemoveChild before laWidget_Delete

@microchip-gfx
Copy link
Contributor

microchip-gfx commented Feb 11, 2020

Due to Harmony's non-blocking nature it is possible for the application to manipulate the graphics state while the graphics library is trying to perform work. It could be in the middle of event processing or painting a frame. The application would likely become unstable if a widget is in the middle of painting and it gets deleted by the application.

The "laContext_IsDrawing" function is provided in order to query the engine state. Manipulation of the state should only occur when this function returns 'false'.

If you're sure the engine isn't performing work and the crash still occurs then it could be a bug in the system.

@LuisCRSousa
Copy link
Author

LuisCRSousa commented Feb 20, 2020

Found a tricky situation still regarding this case.
Sometimes (depending on what I have on the screen at the time, really randomly), if I delete a lawidget that contains a labutton inside (deletion triggered with this button), the panel disappears successfully without problem.
But, afterwards, if I click in the display zone where the button existed before deleting it's parent, the program breaks.

laContext_IsDrawing is returning false before I proceed with the widget deletion.

Found that if I coment line 507-508 of libraria_context.c this problem don't happen.
if(_activeContext->focus != NULL) _activeContext->focus->focusLost(_activeContext->focus);

It looks like harmony is trying to focusLost on a object that don't exist anymore.

@LuisCRSousa
Copy link
Author

Solution

Insert the following lines at _laWidget_Destructor at libaria_widget.c inside childrens for-loop to null focus function.

if(laContext_GetActive()->focus == child || laContext_GetActive()->focus == wgt) laContext_GetActive()->focus = NULL;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants