This commit is contained in:
hypnosis-i2p 2017-09-08 15:59:19 +08:00
parent 1673966e36
commit ef30d2d3b6
6 changed files with 22 additions and 7 deletions

View File

@ -11,6 +11,7 @@ void ClientTunnelPane::setGroupBoxTitle(const QString & title) {
}
void ClientTunnelPane::deleteClientTunnelForm() {
TunnelPane::deleteTunnelForm();
delete clientTunnelNameGroupBox;
clientTunnelNameGroupBox=nullptr;

View File

@ -266,6 +266,7 @@ int ServerTunnelPane::appendServerTunnelForm(
}
void ServerTunnelPane::deleteServerTunnelForm() {
TunnelPane::deleteTunnelForm();
delete serverTunnelNameGroupBox;//->deleteLater();
serverTunnelNameGroupBox=nullptr;

View File

@ -218,3 +218,7 @@ QString TunnelPane::readTunnelTypeComboboxData() {
i2p::data::SigningKeyType TunnelPane::readSigTypeComboboxUI(QComboBox* sigTypeComboBox) {
return (i2p::data::SigningKeyType) sigTypeComboBox->currentData().toInt();
}
void TunnelPane::deleteTunnelForm() {
widgetlocks.deleteListeners();
}

View File

@ -31,6 +31,9 @@ public:
TunnelPane(TunnelsPageUpdateListener* tunnelsPageUpdateListener_, TunnelConfig* tunconf);
virtual ~TunnelPane(){}
void deleteTunnelForm();
virtual ServerTunnelPane* asServerTunnelPane()=0;
virtual ClientTunnelPane* asClientTunnelPane()=0;

View File

@ -12,6 +12,7 @@ class widgetlock : public QObject {
private:
QWidget* widget;
QPushButton* lockButton;
public slots:
void lockButtonClicked(bool) {
bool wasEnabled = widget->isEnabled();
@ -25,7 +26,8 @@ public:
lockButton->setText(lockButton->tr("Edit"));
QObject::connect(lockButton,SIGNAL(clicked(bool)), this, SLOT(lockButtonClicked(bool)));
}
virtual ~widgetlock() {
virtual ~widgetlock() {}
void deleteListener() {
QObject::disconnect(lockButton,SIGNAL(clicked(bool)), this, SLOT(lockButtonClicked(bool)));
}
};

View File

@ -9,15 +9,19 @@ class widgetlockregistry {
public:
widgetlockregistry() : locks() {}
virtual ~widgetlockregistry() {
while(!locks.empty()) {
delete locks.back();
locks.pop_back();
}
}
virtual ~widgetlockregistry() {}
void add(widgetlock* lock) {
locks.push_back(lock);
}
void deleteListeners() {
while(!locks.empty()) {
widgetlock* lock = locks.back();
lock->deleteListener();
delete lock;
locks.pop_back();
}
}
};
#endif // WIDGETLOCKREGISTRY_H