Skip to content

Commit fe11022

Browse files
committed
Cancel pending renaming action for a screen in dtor of ScreensPanel
1 parent 76989e4 commit fe11022

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ScreensPanel.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ static const char* const DynamicFunctions[] = {" ", "Rename", " ", "
5151

5252
static void ScreensPanel_delete(Object* object) {
5353
Panel* super = (Panel*) object;
54+
ScreensPanel* const this = (ScreensPanel*) super;
55+
56+
/* cancel any pending edit action */
57+
if (this->renamingItem) {
58+
ListItem* item = (ListItem*) Panel_getSelected(super);
59+
assert(item);
60+
assert(item == this->renamingItem);
61+
62+
item->value = this->saved;
63+
this->renamingItem = NULL;
64+
super->cursorOn = false;
65+
66+
Panel_setSelectionColor(super, PANEL_SELECTION_FOCUS);
67+
}
5468

5569
/* do not delete screen settings still in use */
5670
int n = Panel_size(super);

0 commit comments

Comments
 (0)