summaryrefslogtreecommitdiffstats
path: root/libpyside/qsignal.cpp
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-10-28 16:28:43 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-10-28 17:40:12 -0300
commitbd8239b1cd99d25c26eb99a051072254342ab0bb (patch)
tree12fce76bd9206473ead1600e05d5591619f98393 /libpyside/qsignal.cpp
parenta1524b78b632d99aa6076391d0d77e46271dd7c8 (diff)
downloadpyside-bd8239b1cd99d25c26eb99a051072254342ab0bb.tar.gz
pyside-bd8239b1cd99d25c26eb99a051072254342ab0bb.tar.xz
pyside-bd8239b1cd99d25c26eb99a051072254342ab0bb.zip
Stop signal/slot connection if is impossible to register that on object.
Created unit test for bug #442, #437. Fixes bug #442. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'libpyside/qsignal.cpp')
-rw-r--r--libpyside/qsignal.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp
index 23ee7ff..31d30fc 100644
--- a/libpyside/qsignal.cpp
+++ b/libpyside/qsignal.cpp
@@ -523,6 +523,8 @@ char* getTypeName(PyObject* type)
return typeName;
} else if (PyString_Check(type)) {
return strdup(PyString_AS_STRING(type));
+ } else if (type == Py_None) {
+ return strdup("void");
}
return 0;
}
@@ -537,7 +539,7 @@ char* signalBuildSignature(const char *name, const char *signature)
char* signalParseSignature(PyObject *args)
{
char *signature = 0;
- if (args && (PyString_Check(args) || (!PySequence_Check(args) && (args != Py_None))))
+ if (args && (PyString_Check(args) || !PySequence_Check(args)))
return getTypeName(args);
for(Py_ssize_t i = 0, i_max = PySequence_Size(args); i < i_max; i++) {
@@ -623,12 +625,11 @@ PyObject* signalNewFromMethod(PyObject* source, const QList<QMetaMethod>& method
item->d = new PySideSignalInstanceDataPrivate;
PySideSignalInstanceDataPrivate* selfPvt = item->d;
selfPvt->source = source;
- const char* cppSignature = m.signature();
+ QByteArray cppName(m.signature());
+ cppName = cppName.mid(0, cppName.indexOf('('));
// separe SignalName
- selfPvt->signalName = strdup(cppSignature);
- char* endName = strchr(selfPvt->signalName, '(');
- endName = '\0';
- selfPvt->signature = strdup(cppSignature);
+ selfPvt->signalName = strdup(cppName.data());
+ selfPvt->signature = strdup(m.signature());
selfPvt->homonymousMethod = 0;
selfPvt->next = 0;
}