fix: a potential segment fault

This commit is contained in:
Chenx Dust
2025-10-10 12:59:59 +08:00
parent eec279cfcd
commit ecc201c5c5
6 changed files with 24 additions and 6 deletions

View File

@@ -17,8 +17,10 @@ AuthInfoWindow::AuthInfoWindow(QWidget *parent)
setWindowModality(Qt::WindowModal);
setAttribute(Qt::WA_DeleteOnClose);
connect(ui->buttonBox, &QDialogButtonBox::accepted, [&]() {
connect(this, &QDialog::accepted, [&]() {
QListWidgetItem *selectedItem = ui->authInfoListWidget->currentItem();
if (!selectedItem)
return;
emit finishAuthInfo(selectedItem->data(Qt::UserRole).toString(),
selectedItem->data(Qt::UserRole + 1).toString(),
selectedItem->data(Qt::UserRole + 2).toString());
@@ -48,7 +50,7 @@ AuthInfoWindow::AuthInfoWindow(QWidget *parent)
QString loginDomain = obj.value("loginDomain").toString();
QString loginUrl = obj.value("loginUrl").toString();
QListWidgetItem *item =
new QListWidgetItem(QString("%1 - %2 - %3 - %4").arg(authName, authType, loginDomain, loginUrl));
new QListWidgetItem(QString("%1 - %2 - %3 - %4").arg(authName, authType, loginDomain, loginUrl.isEmpty()? "" : loginUrl));
item->setData(Qt::UserRole, authType);
item->setData(Qt::UserRole + 1, loginDomain);
item->setData(Qt::UserRole + 2, loginUrl);

View File

@@ -70,5 +70,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>authInfoListWidget</sender>
<signal>itemDoubleClicked(QListWidgetItem*)</signal>
<receiver>AuthInfoWindow</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>224</x>
<y>116</y>
</hint>
<hint type="destinationlabel">
<x>224</x>
<y>124</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -10,7 +10,7 @@ ExtraSettingWindow::ExtraSettingWindow(QDialog *parent) :
setWindowModality(Qt::WindowModal);
setAttribute(Qt::WA_DeleteOnClose);
connect(ui->buttonBox, &QDialogButtonBox::accepted,
connect(this, &QDialog::accepted,
[&]()
{
QStringList tcpPortForwardingList;

View File

@@ -17,7 +17,7 @@ GraphCaptchaWindow::GraphCaptchaWindow(QWidget *parent) : QDialog(parent), ui(ne
setWindowModality(Qt::WindowModal);
setAttribute(Qt::WA_DeleteOnClose);
connect(ui->buttonBox, &QDialogButtonBox::accepted, [&]() {
connect(this, &QDialog::accepted, [&]() {
QJsonObject obj;
QJsonArray points;
for (auto &point : ui->canvas->pointsPx())
@@ -34,7 +34,7 @@ GraphCaptchaWindow::GraphCaptchaWindow(QWidget *parent) : QDialog(parent), ui(ne
emit finishCaptcha(docJson);
});
connect(ui->buttonBox, &QDialogButtonBox::rejected, [&]() {
connect(this, &QDialog::rejected, [&]() {
emit finishCaptcha(QByteArray("{}"));
});

View File

@@ -12,6 +12,7 @@
#include "ssologinwebview/ssologinwebview.h"
#include "zjuconnectcontroller/zjuconnectcontroller.h"
#include "settingwindow/settingwindow.h"
#include "graphcaptchawindow/graphcaptchawindow.h"
namespace Ui
{

View File

@@ -1,7 +1,6 @@
#ifndef ZJUCONNECTCONTROLLER_H
#define ZJUCONNECTCONTROLLER_H
#include "graphcaptchawindow/graphcaptchawindow.h"
#include <QtCore>
enum class ZJU_ERROR