aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-06-22 18:08:25 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-06-23 11:00:37 -0300
commitb1f7791a7257b0fb5a766cd1825fb32d52403bee (patch)
tree1dd325239226ad3745c1b33b2318fb0b58f05dc1
parent09cb758d9ecfa21f4b8c5b73a43ce05ca6ee0492 (diff)
Check for invalid signal or slot name.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--PySide/QtCore/glue/qobject_connect.cpp5
-rw-r--r--libpyside/signalmanager.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/PySide/QtCore/glue/qobject_connect.cpp b/PySide/QtCore/glue/qobject_connect.cpp
index e9de41144..535dd10da 100644
--- a/PySide/QtCore/glue/qobject_connect.cpp
+++ b/PySide/QtCore/glue/qobject_connect.cpp
@@ -25,6 +25,9 @@ static bool getReceiver(PyObject *callback, QObject **receiver, PyObject **self)
static bool qobjectConnect(QObject* source, const char* signal, QObject* receiver, const char* slot, Qt::ConnectionType type)
{
+ if (!signal || !slot)
+ return false;
+
if (!PySide::checkSignal(signal))
return false;
signal++;
@@ -39,7 +42,7 @@ static bool qobjectConnect(QObject* source, const char* signal, QObject* receive
static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject* callback, Qt::ConnectionType type)
{
- if (!PySide::checkSignal(signal))
+ if (!signal || !PySide::checkSignal(signal))
return false;
signal++;
diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp
index d44743cc7..1115d24dd 100644
--- a/libpyside/signalmanager.cpp
+++ b/libpyside/signalmanager.cpp
@@ -82,11 +82,14 @@ using namespace PySide;
bool PySide::isSignal(const char* signal)
{
- return signal[0] == PYSIDE_SIGNAL;
+ return (signal && signal[0] == PYSIDE_SIGNAL);
}
bool PySide::checkSignal(const char* signal)
{
+ if (!signal)
+ return false;
+
if (signal[0] != PYSIDE_SIGNAL) {
PyErr_SetString(PyExc_TypeError, "Use the function PySide.QtCore.SIGNAL on signals");
return false;