projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clean up
[quassel.git]
/
src
/
common
/
syncableobject.cpp
diff --git
a/src/common/syncableobject.cpp
b/src/common/syncableobject.cpp
index
41ac4a5
..
b8c8d5b
100644
(file)
--- a/
src/common/syncableobject.cpp
+++ b/
src/common/syncableobject.cpp
@@
-49,6
+49,14
@@
SyncableObject::SyncableObject(const SyncableObject &other, QObject *parent)
{
}
{
}
+SyncableObject::~SyncableObject() {
+ QList<SignalProxy *> proxies = _signalProxies;
+ _signalProxies.clear();
+ for(int i = 0; i < proxies.count(); i++) {
+ proxies[i]->stopSynchronize(this);
+ }
+}
+
SyncableObject &SyncableObject::operator=(const SyncableObject &other) {
if(this == &other)
return *this;
SyncableObject &SyncableObject::operator=(const SyncableObject &other) {
if(this == &other)
return *this;
@@
-140,7
+148,9
@@
void SyncableObject::renameObject(const QString &newName) {
const QString oldName = objectName();
if(oldName != newName) {
setObjectName(newName);
const QString oldName = objectName();
if(oldName != newName) {
setObjectName(newName);
- emit objectRenamed(newName, oldName);
+ foreach(SignalProxy *proxy, _signalProxies) {
+ proxy->renameObject(this, newName, oldName);
+ }
}
}
}
}
@@
-156,12
+166,12
@@
void SyncableObject::requestUpdate(const QVariantMap &properties) {
emit updateRequested(properties);
}
emit updateRequested(properties);
}
-void SyncableObject::sync_call__(SignalProxy::ProxyMode modeType, const char *funcname, ...) {
- qDebug() << Q_FUNC_INFO << modeType << funcname;
+void SyncableObject::sync_call__(SignalProxy::ProxyMode modeType, const char *funcname, ...)
const
{
+
//
qDebug() << Q_FUNC_INFO << modeType << funcname;
foreach(SignalProxy *proxy, _signalProxies) {
va_list ap;
va_start(ap, funcname);
foreach(SignalProxy *proxy, _signalProxies) {
va_list ap;
va_start(ap, funcname);
- proxy->sync
Call
(this, modeType, funcname, ap);
+ proxy->sync
_call__
(this, modeType, funcname, ap);
va_end(ap);
}
}
va_end(ap);
}
}
@@
-171,3
+181,12
@@
void SyncableObject::synchronize(SignalProxy *proxy) {
return;
_signalProxies << proxy;
}
return;
_signalProxies << proxy;
}
+
+void SyncableObject::stopSynchronize(SignalProxy *proxy) {
+ for(int i = 0; i < _signalProxies.count(); i++) {
+ if(_signalProxies[i] == proxy) {
+ _signalProxies.removeAt(i);
+ break;
+ }
+ }
+}