Commit cdcd1627 by Carwyn

1. 解决业务插件在主线程调用停止服务卡死问题;

parent 6aa8b2c2
...@@ -22,6 +22,16 @@ FMPePay::FMPePay(ctkPluginContext *context) ...@@ -22,6 +22,16 @@ FMPePay::FMPePay(ctkPluginContext *context)
{ {
} }
FMPePay::~FMPePay()
{
StopService();
if (d_ptr) {
delete d_ptr;
d_ptr = nullptr;
}
}
void FMPePay::InitService() void FMPePay::InitService()
{ {
if (_inited) return; if (_inited) return;
......
...@@ -13,11 +13,13 @@ class FMPePay : public FMPePayInterface ...@@ -13,11 +13,13 @@ class FMPePay : public FMPePayInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(FMPBaseInterface) Q_INTERFACES(FMPBaseInterface)
Q_INTERFACES(FMPluginInterface)
Q_INTERFACES(FMPePayInterface) Q_INTERFACES(FMPePayInterface)
Q_DECLARE_PRIVATE(FMPePay) Q_DECLARE_PRIVATE(FMPePay)
public: public:
FMPePay(ctkPluginContext *context); explicit FMPePay(ctkPluginContext *context);
virtual ~FMPePay();
void SetBasicInfo(QVariantHash hash); void SetBasicInfo(QVariantHash hash);
......
...@@ -10,21 +10,22 @@ ...@@ -10,21 +10,22 @@
class FMPePayInterface : public QObject, public FMPluginInterface class FMPePayInterface : public QObject, public FMPluginInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(FMPBaseInterface)
Q_INTERFACES(FMPluginInterface)
public: public:
explicit FMPePayInterface(ctkPluginContext *ctx) : FMPluginInterface(ctx) explicit FMPePayInterface(ctkPluginContext *ctx) : FMPluginInterface(ctx)
{ {
connect(this, &FMPePayInterface::TriggerInit, this, &FMPePayInterface::InitService); connect(this, &FMPePayInterface::TriggerInit, this, &FMPePayInterface::OnTriggerInit);
connect(this, &FMPePayInterface::TriggerUninit, this, &FMPePayInterface::UninitService); connect(this, &FMPePayInterface::TriggerUninit, this, &FMPePayInterface::OnTriggerUninit);
} }
protected slots:
void InitService() = 0;
void UninitService() = 0;
signals: signals:
void TriggerInit(); void TriggerInit();
void TriggerUninit(); void TriggerUninit();
protected slots:
void OnTriggerInit() { FMPluginInterface::OnTriggerInit(); }
void OnTriggerUninit() { FMPluginInterface::OnTriggerUninit(); }
// /** // /**
// * @brief ShowPayDialog // * @brief ShowPayDialog
// * 呈现支付主界面 // * 呈现支付主界面
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#define VER_MINOR 1 #define VER_MINOR 1
#define VER_REVISION 0 #define VER_REVISION 0
#define VER_BUILD 4 #define VER_BUILD 6
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment