[PyQt] [SIP] Segfault with nested template types
Casper Ti. Vector
caspervector at gmail.com
Sun Jul 7 11:15:35 BST 2013
After lost of frustrations I seem to find the correct solution: use
> #define sipType_cell sipFindType("QPair<int, int>")
instead of
> #define sipType_cell sipFindType("cell")
Hope it helps anyone with similar problems in future.
On Sat, Jul 06, 2013 at 02:04:57AM +0800, Casper Ti. Vector wrote:
> 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