Commit acf4517e by Carwyn

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

parent 32832ecf
......@@ -9,6 +9,8 @@ class FMPHome;
class FMPHomeEventHandler : public QObject, public ctkEventHandler
{
Q_OBJECT
Q_INTERFACES(ctkEventHandler)
public:
explicit FMPHomeEventHandler(const QString &topic, FMPHome *home, ctkPluginContext *ctx);
......@@ -20,8 +22,6 @@ protected:
class FMPStartEventHandler : public FMPHomeEventHandler
{
Q_OBJECT
Q_INTERFACES(ctkEventHandler)
public:
explicit FMPStartEventHandler(ctkPluginContext *ctx, FMPHome *home);
void handleEvent(const ctkEvent &event);
......@@ -29,8 +29,6 @@ public:
class FMPUpgradeAckEventHandler : FMPHomeEventHandler
{
Q_OBJECT
Q_INTERFACES(ctkEventHandler)
public:
explicit FMPUpgradeAckEventHandler(ctkPluginContext *ctx, FMPHome *home);
void handleEvent(const ctkEvent &event);
......
......@@ -13,7 +13,11 @@ FMPHome::FMPHome(ctkPluginContext *context)
FMPHome::~FMPHome()
{
StopService();
if (d_ptr) {
delete d_ptr;
d_ptr = nullptr;
}
}
void FMPHome::InitService()
......@@ -22,7 +26,6 @@ void FMPHome::InitService()
Q_D(FMPHome);
d->Init();
}
_semaphore.release(1);
}
void FMPHome::UninitService()
......@@ -31,7 +34,6 @@ void FMPHome::UninitService()
Q_D(FMPHome);
d->Uninit();
}
_semaphore.release(1);
}
int FMPHome::login()
......
......@@ -7,12 +7,13 @@
class FMPHomeInterface : public QObject, public FMPluginInterface
{
Q_OBJECT
Q_INTERFACES(FMPBaseInterface)
Q_INTERFACES(FMPluginInterface)
public:
explicit FMPHomeInterface(ctkPluginContext *ctx) : FMPluginInterface(ctx)
{
connect(this, &FMPHomeInterface::TriggerInit, this, &FMPHomeInterface::InitService);
connect(this, &FMPHomeInterface::TriggerUninit, this, &FMPHomeInterface::UninitService);
connect(this, &FMPHomeInterface::TriggerInit, this, &FMPHomeInterface::OnTriggerInit);
connect(this, &FMPHomeInterface::TriggerUninit, this, &FMPHomeInterface::OnTriggerUninit);
}
virtual int login() = 0;
virtual bool isLogined() = 0;
......@@ -57,14 +58,14 @@ public:
*/
virtual void notification(const QString &msg, const QString &title = QString::fromLocal8Bit(FMP_APPNAME),
QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int mecs = 1000) = 0;
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(FMPHomeInterface, "com.fmp.home")
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 7
#define VER_BUILD 8
//! Convert version numbers to string
#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