Commit 2f19af5a by Carwyn

1. 解决业务插件在主线程调用停止服务卡死问题; 2. 在析构中调用停止服务接口

parent 27759247
......@@ -13,6 +13,16 @@ FMPVip::FMPVip(ctkPluginContext *context)
FMPLoggerInterface::InitContext(context);
}
FMPVip::~FMPVip()
{
StopService();
if (d_ptr) {
delete d_ptr;
d_ptr = nullptr;
}
}
void FMPVip::InitService()
{
d_func()->Init();
......
......@@ -14,9 +14,10 @@ class FMPVip : public FMPVipInterface
Q_DECLARE_PRIVATE(FMPVip)
public:
FMPVip(ctkPluginContext *context);
explicit FMPVip(ctkPluginContext *context);
virtual ~FMPVip();
protected slots:
protected:
void InitService();
void UninitService();
private:
......
......@@ -15,17 +15,17 @@ class FMPVipInterface : public QObject, public FMPluginInterface
public:
explicit FMPVipInterface(ctkPluginContext *ctx) : FMPluginInterface(ctx)
{
connect(this, &FMPVipInterface::TriggerInit, this, &FMPVipInterface::InitService);
connect(this, &FMPVipInterface::TriggerUninit, this, &FMPVipInterface::UninitService);
connect(this, &FMPVipInterface::TriggerInit, this, &FMPVipInterface::OnTriggerInit);
connect(this, &FMPVipInterface::TriggerUninit, this, &FMPVipInterface::OnTriggerUninit);
}
protected slots:
void InitService() = 0;
void UninitService() = 0;
signals:
void TriggerInit();
void TriggerUninit();
protected slots:
void OnTriggerInit() { FMPluginInterface::OnTriggerInit(); }
void OnTriggerUninit() { FMPluginInterface::OnTriggerUninit(); }
};
Q_DECLARE_INTERFACE(FMPVipInterface, "com.fmp.vip")
......
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