Skip to content

Commit a5e1f69

Browse files
committed
Prevent signal recursion when canceling group change
Use explicit disconnect/connect of the signal handler when resetting combobox text to prevent recursion in selectedGroupChanged.
1 parent 90278e1 commit a5e1f69

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/lib/configwidgetslib/impage.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,20 @@ void IMPage::selectedGroupChanged() {
205205
QMessageBox::question(this, _("Current group changed"),
206206
_("Do you want to change group? Changes to "
207207
"current group will be lost!"))) {
208+
// Temporarily disconnect the signal
209+
QMetaObject::Connection connection = disconnect(
210+
ui_->inputMethodGroupComboBox, &QComboBox::currentTextChanged,
211+
this, &IMPage::selectedGroupChanged);
212+
208213
ui_->inputMethodGroupComboBox->setCurrentText(
209214
config_->currentGroup());
215+
216+
// Restore the connection
217+
if (connection) {
218+
connect(ui_->inputMethodGroupComboBox,
219+
&QComboBox::currentTextChanged, this,
220+
&IMPage::selectedGroupChanged);
221+
}
210222
return;
211223
}
212224
}

0 commit comments

Comments
 (0)