[PyQt] [SIP] Segfault with nested template types

Casper Ti. Vector caspervector at gmail.com
Fri Jul 5 19:04:57 BST 2013


test.h:
> #include <qmap.h>
> #include <qpair.h>
> typedef QPair<int, int> cell;
> struct test { QMap<cell, cell> pia; };
> extern test Test;
> void pia_test();

test.cpp:
> #include "test.h"
> using namespace std;
> test Test;
> void pia_test() {
>   Test.pia[QPair<int, int>(0, 0)] = QPair<int, int>(0, 0);
> }

test.sip:
> %Module test
> %ModuleHeaderCode
> #include "test.h"
> #define sipType_cell sipFindType("cell")
> %End
> %Include qmap.sip     // Exactly same file from PyQt4
> %Include qpair.sip    // See above
> typedef QPair<int, int> cell;
> struct test { QMap<cell, cell> pia; };
> test Test;
> void pia_test();

test.py:
> import test
> print(test.Test.pia)  # An empty dictionary
> test.pia_test()
> print(test.Test.pia)  # Causes a segmentation fault

How can I resolve this kind of issues?
Is this some kind of bug?
Thanks very much :)

-- 
My current OpenPGP key:
4096R/0xE18262B5D9BF213A (expires: 2017.1.1)
D69C 1828 2BF2 755D C383 D7B2 E182 62B5 D9BF 213A



More information about the PyQt mailing list