On Friday 19 August 2011 00:06:11 Daniel Smith wrote:
> Hey All,
> 
> Has anyone hit any roadblocks generating bindings (using Shiboken) for
> QGraphicsView subclasses? I'm not having any luck.
> 
> I've been able to work my code down to a super simple test case
> (attached) which consists of a simple library, libtest, which is
> essentially just a single QGraphicsView subclass :
> 
>     class TestView : public QGraphicsView {
> 
>          public :
> 
>              // Constructors
>              TestView(QWidget *parent=NULL);
>     };
> 
>     TestView::TestView(QWidget *parent) : QGraphicsView(parent) {
> 
>     }

After minor tweaks on Makefiles to use python2.7 and adjust some paths your 
example worked on my machine without segfaults.

Anyway if you are creating bindings for Qt-based libraries is good to use the 
following options on generator:

--enable-pyside-extensions
--enable-parent-ctor-heuristic
--enable-return-value-heuristic

> I then have a standard Shiboken setup with a typesystem.xml containing a
> single object-type entry for TestView :
> 
>     <?xml version="1.0"?>
>     <typesystem package="test">
>     <load-typesystem name="typesystem_core.xml" generate="no"/>
>     <load-typesystem name="typesystem_gui.xml" generate="no"/>
>     <object-type name="TestView"/>
>     </typesystem>
> 
> and a global.h :
> 
>     #undef QT_NO_STL
>     #undef QT_NO_STL_WCHAR
> 
>     #ifndef NULL
>     #define NULL    0
>     #endif
> 
>     #include "pyside_global.h">
>     #include <test.hh>
> 
> If I then 'make' the project, everything compiles fine, but the
> resulting module seqmentation faults on import inside
> Shiboken::ObjectType::getMultipleIheritanceFunction(SbkObjectType*).
> 
> Here's the gdb back trace :
> 
>     #0  0x00007ffff4966907 in
>     Shiboken::ObjectType::getMultipleIheritanceFunction(SbkObjectType*)
>     () from
>    
> /vol/apps/pyside_qt4.7_kubuntu_10_04-1.0.4_64/lib/libshiboken-python2.6.so
> .1.0 #1  0x00007ffff62ca558 in init_TestView (module=0x7ffff6b671d8) at
> test/testview_wrapper.cpp:1537
>     #2  0x00007ffff62ca2d1 in inittest () at
> test/test_module_wrapper.cpp:58 #3  0x00007ffff7b27eeb in
> _PyImport_LoadDynamicModule
>     (name=0x7fffffff52a0 "test", pathname=0x7fffffff41e0 "test.so",
>     fp=<value optimized out>) at ./Python/importdl.c:53
>     #4  0x00007ffff7b25fd9 in import_submodule (mod=0x7ffff7da2b40,
>     subname=0x7fffffff52a0 "test", fullname=0x7fffffff52a0 "test") at
>     Python/import.c:2589
>     #5  0x00007ffff7b2623b in load_next (mod=0x7ffff7da2b40,
>     altmod=0x7ffff7da2b40, p_name=<value optimized out>,
>     buf=0x7fffffff52a0 "test", p_buflen=0x7fffffff62b0) at
>     Python/import.c:2409
>     #6  0x00007ffff7b2675f in PyImport_ImportModuleLevel (name=<value
>     optimized out>, globals=0x63cd30, locals=<value optimized out>,
>     fromlist=0x7ffff7da2b40, level=<value optimized out>) at
>     Python/import.c:2131
>     #7  0x00007ffff7b01f0d in builtin___import__ (self=<value optimized
>     out>, args=<value optimized out>, kwds=<value optimized out>) at
>     Python/bltinmodule.c:48
>     #8  0x00007ffff7a700b2 in PyObject_Call (func=0x7ffff7fa9098,
>     arg=0x7ffff7ed7a48, kw=0x0) at Objects/abstract.c:2492
>     #9  0x00007ffff7b07645 in PyEval_CallObjectWithKeywords
>     (func=0x7ffff7fa9098, arg=0x7ffff7ed7a48, kw=0x0) at
> Python/ceval.c:3575 #10 0x00007ffff7b0a1b4 in PyEval_EvalFrameEx
> (f=0x7d6600,
>     throwflag=<value optimized out>) at Python/ceval.c:2136
>     #11 0x00007ffff7b0e673 in PyEval_EvalCodeEx (co=0x7ffff6bd1a80,
>     globals=<value optimized out>, locals=<value optimized out>,
>     args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0,
>     closure=0x0) at Python/ceval.c:2968
>     #12 0x00007ffff7b0ea72 in PyEval_EvalCode (co=0x601140,
>     globals=0x60, locals=0x7fffef2ed6c0) at Python/ceval.c:522
>     #13 0x00007ffff7b328a0 in PyRun_InteractiveOneFlags (fp=<value
>     optimized out>, filename=0x7ffff7b69d97 "<stdin>",
>     flags=0x7fffffff6880) at Python/pythonrun.c:1335
>     #14 0x00007ffff7b32aae in PyRun_InteractiveLoopFlags
>     (fp=0x7ffff717f6a0, filename=0x7ffff7b69d97 "<stdin>",
>     flags=0x7fffffff6880) at Python/pythonrun.c:760
>     #15 0x00007ffff7b32bbc in PyRun_AnyFileExFlags (fp=0x7ffff717f6a0,
>     filename=0x7ffff7b69d97 "<stdin>", closeit=0, flags=0x7fffffff6880)
>     at Python/pythonrun.c:729
>     #16 0x00007ffff7b3e722 in Py_Main (argc=<value optimized out>,
>     argv=0x7fffffff69a8) at Modules/main.c:599
>     #17 0x00007ffff6e20c4d in __libc_start_main (main=<value optimized
>     out>, argc=<value optimized out>, ubp_av=<value optimized out>,
>     init=<value optimized out>, fini=<value optimized out>,
>     rtld_fini=<value optimized out>,
>          stack_end=0x7fffffff6998) at libc-start.c:226
>     #18 0x0000000000400619 in _start ()
> 
> Any help would be greatly appreciated!
> 
> Cheers,
> Daniel

-- 
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
PySide mailing list
PySide@lists.pyside.org
http://lists.pyside.org/listinfo/pyside

Reply via email to