mirror of
https://github.com/QuasarApp/qca.git
synced 2025-04-29 13:04:31 +00:00
don't allow deleting KeyStoreManager during tracker_updated
svn path=/trunk/kdesupport/qca/; revision=681482
This commit is contained in:
parent
da75f343de
commit
331a1d0e24
@ -112,6 +112,8 @@ public:
|
|||||||
bool startedAll;
|
bool startedAll;
|
||||||
bool busy;
|
bool busy;
|
||||||
|
|
||||||
|
QMutex updateMutex;
|
||||||
|
|
||||||
KeyStoreTracker()
|
KeyStoreTracker()
|
||||||
{
|
{
|
||||||
self = this;
|
self = this;
|
||||||
@ -120,7 +122,7 @@ public:
|
|||||||
qRegisterMetaType< QList<QCA::KeyStoreEntry> >("QList<QCA::KeyStoreEntry>");
|
qRegisterMetaType< QList<QCA::KeyStoreEntry> >("QList<QCA::KeyStoreEntry>");
|
||||||
qRegisterMetaType< QList<QCA::KeyStoreEntry::Type> >("QList<QCA::KeyStoreEntry::Type>");
|
qRegisterMetaType< QList<QCA::KeyStoreEntry::Type> >("QList<QCA::KeyStoreEntry::Type>");
|
||||||
|
|
||||||
connect(this, SIGNAL(updated_p()), SIGNAL(updated()), Qt::QueuedConnection);
|
connect(this, SIGNAL(updated_p()), SLOT(updated_locked()), Qt::QueuedConnection);
|
||||||
|
|
||||||
startedAll = false;
|
startedAll = false;
|
||||||
busy = true; // we start out busy
|
busy = true; // we start out busy
|
||||||
@ -165,6 +167,20 @@ public:
|
|||||||
dtext.clear();
|
dtext.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// thread-safe
|
||||||
|
void addTarget(QObject *ksm)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&updateMutex);
|
||||||
|
ksm->connect(this, SIGNAL(updated()), SLOT(tracker_updated()), Qt::DirectConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
// thread-safe
|
||||||
|
void removeTarget(QObject *ksm)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&updateMutex);
|
||||||
|
disconnect(ksm);
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void spinEventLoop()
|
void spinEventLoop()
|
||||||
{
|
{
|
||||||
@ -307,6 +323,13 @@ signals:
|
|||||||
void updated();
|
void updated();
|
||||||
void updated_p();
|
void updated_p();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updated_locked()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&updateMutex);
|
||||||
|
emit updated();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool haveProviderSource(Provider *p) const
|
bool haveProviderSource(Provider *p) const
|
||||||
{
|
{
|
||||||
@ -1462,7 +1485,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void tracker_updated()
|
void tracker_updated()
|
||||||
{
|
{
|
||||||
QCA_logTextMessage(QString("keystore: tracker_updated start"), Logger::Information);
|
QCA_logTextMessage(QString().sprintf("keystore: %p: tracker_updated start", q), Logger::Information);
|
||||||
|
|
||||||
QMutexLocker locker(&m);
|
QMutexLocker locker(&m);
|
||||||
if(!pending)
|
if(!pending)
|
||||||
@ -1477,7 +1500,7 @@ public slots:
|
|||||||
w.wakeOne();
|
w.wakeOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
QCA_logTextMessage(QString("keystore: tracker_updated end"), Logger::Information);
|
QCA_logTextMessage(QString().sprintf("keystore: %p: tracker_updated end", q), Logger::Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update()
|
void update()
|
||||||
@ -1516,13 +1539,13 @@ KeyStoreManager::KeyStoreManager(QObject *parent)
|
|||||||
{
|
{
|
||||||
ensure_init();
|
ensure_init();
|
||||||
d = new KeyStoreManagerPrivate(this);
|
d = new KeyStoreManagerPrivate(this);
|
||||||
d->connect(KeyStoreTracker::instance(), SIGNAL(updated()),
|
KeyStoreTracker::instance()->addTarget(d);
|
||||||
SLOT(tracker_updated()), Qt::DirectConnection);
|
|
||||||
sync();
|
sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyStoreManager::~KeyStoreManager()
|
KeyStoreManager::~KeyStoreManager()
|
||||||
{
|
{
|
||||||
|
KeyStoreTracker::instance()->removeTarget(d);
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user