Clearing Label causes Data Abort Error

Important: unclear posts may not receive useful answers.

Description

What MCU/Processor/Board and compiler are you using?

Cortex A9 *processor, GCC

What LVGL version are you using?

5.0

What do you want to achieve?

Clear a Label

What have you tried so far?

Use obj_delete, delete the pointer itself, set the label text again

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:

lv_obj_t * autoWinOp;
lv_obj_t * autoWinAlly;
lv_obj_t * autonOp;
lv_obj_t * autonAlly;
lv_obj_t * skills;
const char* a = "hello";
lv_obj_t * autoWinOpLabel;
lv_obj_t * autoWinAllyLabel;
lv_obj_t * autonOpLabel;
lv_obj_t * autonAllyLabel;
lv_obj_t * skillsLabel;
lv_obj_t * autonCurrent;
int autonFunc = 0;


lv_style_t myButtonStyleREL; //relesed style
lv_style_t myButtonStylePR; //pressed style

lv_res_t btn_click_action(lv_obj_t * btn)
{
    uint8_t id = lv_obj_get_free_num(btn); //id usefull when there are multiple buttons

	if(id == 0){
		autonFunc = 0;
		//lv_obj_del(autonCurrent);
		delete autonCurrent;
		autonCurrent = NULL;
		lv_obj_t * autonCurrent = lv_label_create(lv_scr_act(), NULL);
		lv_obj_align(autonCurrent, NULL, LV_ALIGN_CENTER, -20,0);
		lv_label_set_text(autonCurrent, "Current Auton: Auto Win Op");
    }
	else if(id == 1){
		//lv_obj_del(autonCurrent);
		autonFunc = 1;
		delete autonCurrent;
		autonCurrent = NULL;
		lv_obj_t * autonCurrent = lv_label_create(lv_scr_act(), NULL);
		lv_obj_align(autonCurrent, NULL, LV_ALIGN_CENTER, -20,0);
		lv_label_set_text(autonCurrent, "Current Auton: Auto Win Ally");
	}
	else if(id == 2){
		//lv_obj_del(autonCurrent);
		autonFunc = 2;
		//lv_obj_t * autonCurrent = lv_label_create(lv_scr_act(), NULL);
		//lv_obj_align(autonCurrent, NULL, LV_ALIGN_CENTER, -20,0);
		lv_label_set_text(autonCurrent, "");
	}
	else if(id == 3){
		//lv_obj_del(autonCurrent);
		autonFunc = 3;
		lv_obj_t * autonCurrent = lv_label_create(lv_scr_act(), NULL);
		lv_obj_align(autonCurrent, NULL, LV_ALIGN_CENTER, -20,0);
		lv_label_set_text(autonCurrent, "Current Auton: Ally");
	}
	else if(id == 4){
		//lv_obj_del(autonCurrent);
		lv_obj_t * autonCurrent = lv_label_create(lv_scr_act(), NULL);
		lv_obj_align(autonCurrent, NULL, LV_ALIGN_CENTER, -20,0);
		autonFunc = 4;
		//lv_label_set_text(autonCurrent, "Current Auton: Skills");
		a = "Skills";
	}

    return LV_RES_OK;
}



void on_center_button() {

}

/**
 * Runs initialization code. This occurs as soon as the program is started.
 *
 * All other competition modes are blocked by initialize; it is recommended
 * to keep execution time for this mode under a few seconds.
 */
void initialize() {
	lv_style_copy(&myButtonStyleREL, &lv_style_plain);
    myButtonStyleREL.body.main_color = LV_COLOR_MAKE(255,81,47);
    myButtonStyleREL.body.grad_color = LV_COLOR_MAKE(221, 36, 118);
    myButtonStyleREL.body.radius = 0;
    myButtonStyleREL.text.color = LV_COLOR_MAKE(255, 255, 255);

    lv_style_copy(&myButtonStylePR, &lv_style_plain);
    myButtonStylePR.body.main_color = LV_COLOR_MAKE(255, 0, 0);
    myButtonStylePR.body.grad_color = LV_COLOR_MAKE(0, 0, 255);
    myButtonStylePR.body.radius = 0;
    myButtonStylePR.text.color = LV_COLOR_MAKE(255, 255, 255);

    autoWinOp = lv_btn_create(lv_scr_act(), NULL); //create button, lv_scr_act() is deafult screen object
	lv_obj_set_free_num(autoWinOp, 0); //set button is to 0
	lv_btn_set_action(autoWinOp, LV_BTN_ACTION_CLICK, btn_click_action); //set function to be called on button click
	lv_btn_set_style(autoWinOp, LV_BTN_STYLE_REL, &myButtonStyleREL); //set the relesed style
	lv_btn_set_style(autoWinOp, LV_BTN_STYLE_PR, &myButtonStylePR); //set the pressed style
	lv_obj_set_size(autoWinOp, 200, 50); //set the button size
	lv_obj_align(autoWinOp, NULL, LV_ALIGN_IN_TOP_LEFT, 10, 10); //set the position to top mid
	autoWinOpLabel = lv_label_create(autoWinOp, NULL); //create label and puts it inside of the button
	lv_label_set_text(autoWinOpLabel, "Auto Win Op"); //sets label text
	lv_obj_align(autoWinOpLabel, NULL, LV_ALIGN_CENTER, 0, 0); //set the position to center

	autoWinAlly = lv_btn_create(lv_scr_act(), NULL); //create button, lv_scr_act() is deafult screen object
	lv_obj_set_free_num(autoWinAlly, 1); //set button is to 0
	lv_btn_set_action(autoWinAlly, LV_BTN_ACTION_CLICK, btn_click_action); //set function to be called on button click
	lv_btn_set_style(autoWinAlly, LV_BTN_STYLE_REL, &myButtonStyleREL); //set the relesed style
	lv_btn_set_style(autoWinAlly, LV_BTN_STYLE_PR, &myButtonStylePR); //set the pressed style
	lv_obj_set_size(autoWinAlly, 200, 50); //set the button size
	lv_obj_align(autoWinAlly, NULL, LV_ALIGN_IN_TOP_RIGHT, -10, 10); //set the position to top mid
	autoWinAllyLabel = lv_label_create(autoWinAlly, NULL); //create label and puts it inside of the button
	lv_label_set_text(autoWinAllyLabel, "Auto Win Ally"); //sets label text
	lv_obj_align(autoWinAllyLabel, NULL, LV_ALIGN_CENTER, 0, 0); //set the position to center

	autonOp = lv_btn_create(lv_scr_act(), NULL); //create button, lv_scr_act() is deafult screen object
	lv_obj_set_free_num(autonOp, 2); //set button is to 0
	lv_btn_set_action(autonOp, LV_BTN_ACTION_CLICK, btn_click_action); //set function to be called on button click
	lv_btn_set_style(autonOp, LV_BTN_STYLE_REL, &myButtonStyleREL); //set the relesed style
	lv_btn_set_style(autonOp, LV_BTN_STYLE_PR, &myButtonStylePR); //set the pressed style
	lv_obj_set_size(autonOp, 150, 50); //set the button size
	lv_obj_align(autonOp, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 10, -10); //set the position to top mid
	autonOpLabel = lv_label_create(autonOp, NULL); //create label and puts it inside of the button
	lv_label_set_text(autonOpLabel, "Op"); //sets label text
	lv_obj_align(autonOpLabel, NULL, LV_ALIGN_CENTER, 0, 0); //set the position to center
	
	autonAlly = lv_btn_create(lv_scr_act(), NULL); //create button, lv_scr_act() is deafult screen object
	lv_obj_set_free_num(autonAlly, 3); //set button is to 0
	lv_btn_set_action(autonAlly, LV_BTN_ACTION_CLICK, btn_click_action); //set function to be called on button click
	lv_btn_set_style(autonAlly, LV_BTN_STYLE_REL, &myButtonStyleREL); //set the relesed style
	lv_btn_set_style(autonAlly, LV_BTN_STYLE_PR, &myButtonStylePR); //set the pressed style
	lv_obj_set_size(autonAlly, 150, 50); //set the button size
	lv_obj_align(autonAlly, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -10, -10); //set the position to top mid
	autonAllyLabel = lv_label_create(autonAlly, NULL); //create label and puts it inside of the button
	lv_label_set_text(autonAllyLabel, "Ally"); //sets label text

	skills = lv_btn_create(lv_scr_act(), NULL); //create button, lv_scr_act() is deafult screen object
	lv_obj_set_free_num(skills, 4); //set button is to 0
	lv_btn_set_action(skills, LV_BTN_ACTION_CLICK, btn_click_action); //set function to be called on button click
	lv_btn_set_style(skills, LV_BTN_STYLE_REL, &myButtonStyleREL); //set the relesed style
	lv_btn_set_style(skills, LV_BTN_STYLE_PR, &myButtonStylePR); //set the pressed style
	lv_obj_set_size(skills, 150, 50); //set the button size
	lv_obj_align(skills, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -10); //set the position to top mid
	skillsLabel = lv_label_create(skills, NULL); //create label and puts it inside of the button
	lv_label_set_text(skillsLabel, "Skills"); //sets label text

	lv_obj_t * autonCurrent = lv_label_create(lv_scr_act(), NULL);
	lv_obj_align(autonCurrent, NULL, LV_ALIGN_CENTER, -20,0);
	lv_label_set_text(autonCurrent, "Current Auton: None");

	lv_obj_t * positionX = lv_label_create(lv_scr_act(), NULL); //create label and puts it on the middle of the screen
	int posX,posY;
	posX = 0;
	posY = 0;
	

	//print posX and posY

	
	

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

The error is caused at if id == 2, the other ids are for trying out different solutions.