mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[Fix] Allocating AcceptLanguage dialog on heap. Should close #156
- crash when accepting Preferences
This commit is contained in:
parent
6cdb61990d
commit
2c9837eaef
@ -127,8 +127,8 @@ QStringList AcceptLanguage::expand(const QLocale::Language &language)
|
||||
void AcceptLanguage::addLanguage()
|
||||
{
|
||||
Ui_AddAcceptLanguage _ui = Ui_AddAcceptLanguage();
|
||||
QDialog dialog(this);
|
||||
_ui.setupUi(&dialog);
|
||||
QDialog* dialog = new QDialog(this);
|
||||
_ui.setupUi(dialog);
|
||||
|
||||
QStringList allLanguages;
|
||||
for (int i = 1 + (int)QLocale::C; i <= (int)QLocale::LastLanguage; ++i) {
|
||||
@ -137,9 +137,10 @@ void AcceptLanguage::addLanguage()
|
||||
|
||||
_ui.listWidget->addItems(allLanguages);
|
||||
|
||||
connect(_ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), &dialog, SLOT(accept()));
|
||||
connect(_ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), dialog, SLOT(accept()));
|
||||
|
||||
if (dialog.exec() == QDialog::Rejected) {
|
||||
if (dialog->exec() == QDialog::Rejected) {
|
||||
delete dialog;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -150,12 +151,14 @@ void AcceptLanguage::addLanguage()
|
||||
else {
|
||||
QListWidgetItem* c = _ui.listWidget->currentItem();
|
||||
if (!c) {
|
||||
delete dialog;
|
||||
return;
|
||||
}
|
||||
|
||||
ui->listWidget->addItem(c->text());
|
||||
}
|
||||
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
void AcceptLanguage::removeLanguage()
|
||||
|
@ -524,8 +524,10 @@ void Preferences::openSslManager()
|
||||
|
||||
void Preferences::showAcceptLanguage()
|
||||
{
|
||||
AcceptLanguage a(this);
|
||||
a.exec();
|
||||
AcceptLanguage* a = new AcceptLanguage(this);
|
||||
a->exec();
|
||||
|
||||
delete a;
|
||||
}
|
||||
|
||||
void Preferences::cacheValueChanged(int value)
|
||||
|
Loading…
Reference in New Issue
Block a user