[PyQt] [SIP] Segfault with nested template types

Casper Ti. Vector caspervector at gmail.com
Sat Jul 6 12:11:19 BST 2013


Follow up: after replacing code of pia_test() with
> Test.pia.clear();
with everything else unchanged, this issue can still be reproduced.

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