summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <pcacjr@gmail.com>2011-12-16 18:10:45 -0300
committerPaulo Alcantara <pcacjr@gmail.com>2011-12-17 01:31:44 +0000
commit86c6261dac472b623d5799a11dee6c8956daf600 (patch)
tree99bddaeb78e479c3e2e4494cde058825b5b39490
parentebf5e4f9abe2fdcce050648aac938b6cb016abbb (diff)
downloadpyside-86c6261dac472b623d5799a11dee6c8956daf600.tar.gz
pyside-86c6261dac472b623d5799a11dee6c8956daf600.tar.xz
pyside-86c6261dac472b623d5799a11dee6c8956daf600.zip
Fix BUG #1084 - "Crash (segfault) when writing unicode string on socket"
See http://bugs.pyside.org/show_bug.cgi?id=1084. Signed-off-by: Paulo Alcantara <pcacjr@gmail.com> Reviewed-by: Trust me
-rw-r--r--PySide/QtCore/typesystem_core_common.xml21
-rw-r--r--tests/QtNetwork/CMakeLists.txt1
-rw-r--r--tests/QtNetwork/bug_1084.py16
3 files changed, 25 insertions, 13 deletions
diff --git a/PySide/QtCore/typesystem_core_common.xml b/PySide/QtCore/typesystem_core_common.xml
index e9c4c85..1fd95a1 100644
--- a/PySide/QtCore/typesystem_core_common.xml
+++ b/PySide/QtCore/typesystem_core_common.xml
@@ -2674,20 +2674,15 @@
<modify-function signature="waitForReadyRead(int)" allow-thread="yes"/>
<modify-function signature="waitForBytesWritten(int)" allow-thread="yes"/>
<!-- ### peek(qint64) do the job -->
- <modify-function signature="peek(char *,qint64)" remove="all"/>
+ <modify-function signature="peek(char*, qint64)" remove="all"/>
<!-- ### read(qint64) do the job -->
- <modify-function signature="read(char *,qint64)" remove="all"/>
+ <modify-function signature="read(char*, qint64)" remove="all"/>
<!-- ### readLine(qint64) do the job -->
- <modify-function signature="readLine(char *,qint64)" remove="all"/>
+ <modify-function signature="readLine(char*, qint64)" remove="all"/>
<!-- ### write(str) do the job -->
- <modify-function signature="write(const char *,qint64)" remove="all"/>
- <modify-function signature="write(const char *)">
- <inject-code>
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, Shiboken::String::len(%PYARG_1));
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
- </modify-function>
- <modify-function signature="getChar(char *)">
+ <modify-function signature="write(const char*, qint64)" remove="all"/>
+ <modify-function signature="write(const char*)" remove="all"/>
+ <modify-function signature="getChar(char*)">
<modify-argument index="1">
<remove-argument />
<remove-default-expression />
@@ -2696,7 +2691,7 @@
<insert-template name="fix_char*" />
</inject-code>
</modify-function>
- <modify-function signature="readData(char *,qint64)">
+ <modify-function signature="readData(char*, qint64)">
<inject-code class="target">
QByteArray ba;
ba.resize(%2);
@@ -2720,7 +2715,7 @@
</conversion-rule>
</modify-argument>
</modify-function>
- <modify-function signature="readLineData(char *,qint64)">
+ <modify-function signature="readLineData(char*, qint64)">
<inject-code class="target">
QByteArray ba;
ba.resize(%2);
diff --git a/tests/QtNetwork/CMakeLists.txt b/tests/QtNetwork/CMakeLists.txt
index 3077155..7476f91 100644
--- a/tests/QtNetwork/CMakeLists.txt
+++ b/tests/QtNetwork/CMakeLists.txt
@@ -1,4 +1,5 @@
PYSIDE_TEST(bug_446.py)
+PYSIDE_TEST(bug_1084.py)
PYSIDE_TEST(basic_auth_test.py)
PYSIDE_TEST(accessManager_test.py)
PYSIDE_TEST(http_test.py)
diff --git a/tests/QtNetwork/bug_1084.py b/tests/QtNetwork/bug_1084.py
new file mode 100644
index 0000000..9d8471c
--- /dev/null
+++ b/tests/QtNetwork/bug_1084.py
@@ -0,0 +1,16 @@
+''' unit test for BUG #1084 '''
+
+import unittest
+from PySide import QtNetwork
+import py3kcompat as py3k
+
+class QTcpSocketTestCase(unittest.TestCase):
+ def setUp(self):
+ self.sock = QtNetwork.QTcpSocket()
+ self.sock.connectToHost('127.0.0.1', 25)
+
+ def testIt(self):
+ self.sock.write(py3k.unicode_('quit'))
+
+if __name__ == "__main__":
+ unittest.main()