类析构时取消其设置的回调函数

This commit is contained in:
ranchuan
2023-11-30 10:50:05 +08:00
parent e34b8111dc
commit ae972b21aa
4 changed files with 81 additions and 11 deletions

View File

@@ -9,8 +9,19 @@ class selfdev_check : public HandlePc
{
Q_OBJECT
public:
selfdev_check() : HandlePc() {slave_acked_num=0;}
~selfdev_check() {}
selfdev_check() : HandlePc() {
slave_acked_num=0;
moter_down_cb_fun=nullptr;
}
~selfdev_check() {
if(moter_down_cb_fun!=nullptr){
// 取消电机下降到位回调
prot_m4 *m4 = protM4();
if(m4!=nullptr) {
m4->del_irq_fun(moter_down_cb_fun,"moter ");
}
}
}
int dolater(int cmd, myarray data);
void timeout();
public slots:
@@ -18,6 +29,7 @@ public slots:
protected:
QList<myarray> slave_acked;
int slave_acked_num;
prot_m4_cb moter_down_cb_fun;
signals:
void send_to_m4_signal(myarray data);
};
@@ -40,4 +52,24 @@ signals:
// 小板升级
class selfdev_slaveupdate : public HandlePc
{
Q_OBJECT
public:
selfdev_slaveupdate() : HandlePc() {}
~selfdev_slaveupdate() {}
int dolater(int cmd, myarray data);
void timeout();
signals:
void send_to_m4_signal(myarray data);
};
#endif