QT, ctypes dll and SEG Faults

Wojtek Walczak gminick at bzt.bzt
Sun Aug 17 07:28:42 EDT 2008


On Sat, 16 Aug 2008 21:17:25 -0700 (PDT), sapsi wrote:
>> Below is a small class using ctypes and libspectre to read a
>> postscript file.
>> My program is a PyQT 4.4 application  and when the user clicks on a
>> entry in a QTableWidget, i run
>>
>> PostScriptImage( filename_as_contained_in_clicked_tableWidgetItem )
>> However on i get a segfault while trying document_load.
>> Surprisingly, before i run sys.exit(app.exec_()) (i.e before the app
>> starts) if run PostScriptImage(command_line_specified_ps_file) it
>> works!

> To answer my own question, partially, i found out if i replace
> filename with a hard coded value it doesn't crash.
> Now why is that? Does python lose the reference? Should i store
> filename as attributed of the object?

Are you sure that the hardcoded value is _exactly_ the same
as the one passed to __init__? Try it in __init__ to make sure:

assert filename == 'your_hardcoded_value'

And why won't you try to store the filename as an attribute?
(even though I doubt it could help).

-- 
Regards,
Wojtek Walczak,
http://www.stud.umk.pl/~wojtekwa/



More information about the Python-list mailing list