Changed family keyboard key map dialog logic to prevent premature deletion of object during close.

This commit is contained in:
mjbudd77 2022-03-08 20:08:03 -05:00
parent 84cf82cb6a
commit 3bc0af149b
2 changed files with 20 additions and 6 deletions

View File

@ -1449,6 +1449,7 @@ FKBKeyMapDialog::FKBKeyMapDialog( int idx, QWidget *parent )
keyIdx = idx; keyIdx = idx;
buttonConfigStatus = 0; buttonConfigStatus = 0;
waitingForButton = false;
mainLayout = new QVBoxLayout(); mainLayout = new QVBoxLayout();
hbox = new QHBoxLayout(); hbox = new QHBoxLayout();
@ -1499,6 +1500,8 @@ void FKBKeyMapDialog::enterButtonLoop(void)
{ {
buttonConfigStatus = 2; buttonConfigStatus = 2;
waitingForButton = true;
ButtonConfigBegin(); ButtonConfigBegin();
DWaitButton(NULL, &fkbmap[ keyIdx ], &buttonConfigStatus); DWaitButton(NULL, &fkbmap[ keyIdx ], &buttonConfigStatus);
@ -1507,25 +1510,35 @@ void FKBKeyMapDialog::enterButtonLoop(void)
buttonConfigStatus = 1; buttonConfigStatus = 1;
waitingForButton = false;
done(0); done(0);
deleteLater(); deleteLater();
} }
//********************************************************************************* //*********************************************************************************
void FKBKeyMapDialog::closeEvent(QCloseEvent *event) void FKBKeyMapDialog::closeEvent(QCloseEvent *event)
{ {
printf("FKB Key Map Close Window Event\n"); //printf("FKB Key Map Close Window Event\n");
buttonConfigStatus = 0; buttonConfigStatus = 0;
done(0);
deleteLater(); if ( !waitingForButton )
{
done(0);
deleteLater();
}
event->accept(); event->accept();
} }
//********************************************************************************* //*********************************************************************************
void FKBKeyMapDialog::closeWindow(void) void FKBKeyMapDialog::closeWindow(void)
{ {
printf("Close Window\n"); //printf("Close Window\n");
buttonConfigStatus = 0; buttonConfigStatus = 0;
done(0);
deleteLater(); if ( !waitingForButton )
{
done(0);
deleteLater();
}
} }
//********************************************************************************* //*********************************************************************************
void FKBKeyMapDialog::keyPressEvent(QKeyEvent *event) void FKBKeyMapDialog::keyPressEvent(QKeyEvent *event)

View File

@ -124,6 +124,7 @@ protected:
QLabel *msgLbl; QLabel *msgLbl;
QLabel *curMapLbl; QLabel *curMapLbl;
bool waitingForButton;
public slots: public slots:
void closeWindow(void); void closeWindow(void);