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
This commit is contained in:
parent
8ddbd3167b
commit
481ba5aa3e
3 changed files with 25 additions and 13 deletions
|
|
@ -2666,20 +2666,15 @@
|
||||||
<modify-function signature="waitForReadyRead(int)" allow-thread="yes"/>
|
<modify-function signature="waitForReadyRead(int)" allow-thread="yes"/>
|
||||||
<modify-function signature="waitForBytesWritten(int)" allow-thread="yes"/>
|
<modify-function signature="waitForBytesWritten(int)" allow-thread="yes"/>
|
||||||
<!-- ### peek(qint64) do the job -->
|
<!-- ### 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 -->
|
<!-- ### 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 -->
|
<!-- ### 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 -->
|
<!-- ### write(str) do the job -->
|
||||||
<modify-function signature="write(const char *,qint64)" remove="all"/>
|
<modify-function signature="write(const char*, qint64)" remove="all"/>
|
||||||
<modify-function signature="write(const char *)">
|
<modify-function signature="write(const char*)" remove="all"/>
|
||||||
<inject-code>
|
<modify-function signature="getChar(char*)">
|
||||||
%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-argument index="1">
|
<modify-argument index="1">
|
||||||
<remove-argument />
|
<remove-argument />
|
||||||
<remove-default-expression />
|
<remove-default-expression />
|
||||||
|
|
@ -2688,7 +2683,7 @@
|
||||||
<insert-template name="fix_char*" />
|
<insert-template name="fix_char*" />
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</modify-function>
|
</modify-function>
|
||||||
<modify-function signature="readData(char *,qint64)">
|
<modify-function signature="readData(char*, qint64)">
|
||||||
<inject-code class="target">
|
<inject-code class="target">
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
ba.resize(%2);
|
ba.resize(%2);
|
||||||
|
|
@ -2712,7 +2707,7 @@
|
||||||
</conversion-rule>
|
</conversion-rule>
|
||||||
</modify-argument>
|
</modify-argument>
|
||||||
</modify-function>
|
</modify-function>
|
||||||
<modify-function signature="readLineData(char *,qint64)">
|
<modify-function signature="readLineData(char*, qint64)">
|
||||||
<inject-code class="target">
|
<inject-code class="target">
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
ba.resize(%2);
|
ba.resize(%2);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
PYSIDE_TEST(bug_446.py)
|
PYSIDE_TEST(bug_446.py)
|
||||||
|
PYSIDE_TEST(bug_1084.py)
|
||||||
PYSIDE_TEST(basic_auth_test.py)
|
PYSIDE_TEST(basic_auth_test.py)
|
||||||
PYSIDE_TEST(accessManager_test.py)
|
PYSIDE_TEST(accessManager_test.py)
|
||||||
PYSIDE_TEST(http_test.py)
|
PYSIDE_TEST(http_test.py)
|
||||||
|
|
|
||||||
16
tests/QtNetwork/bug_1084.py
Normal file
16
tests/QtNetwork/bug_1084.py
Normal file
|
|
@ -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()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue