[PyQt] Segmentation Fault working with QTextDocument/QTextEdit

Nahuel Defossé nahueldefosse at yahoo.com.ar
Tue Jan 13 22:08:17 GMT 2009


El Tuesday 13 January 2009 17:11:48 Nahuel Defossé escribió:
> Hi
> I'm working on a text editor (still in very early development state).
> First, I tried to set my custom QTextDocument class (CodeDocument) each
> time a new file was opened but I always got a segementation fault. So I
> googled a bit and got a qcodeedit project at srourceforge, where I saw they
> don't mess with QTextDocument at all, even I didn't like the idea of
> leaving a MVC scheme (QTextEdit/QTextDocument) and hoping to get rid of the
> unexplainable segfault, I decided to just leave a CodeDocument instance and
> load files into it via a factory (all of these code is in editor.py). What
> I've got was taht creating an empty document (there's a QAction, Ctrl+N)
> works fine, but if you try to load any file, it just segfaults. I've tested
> it on Kubuntu Hardy and Ubuntu Intrepid. Though it fails in both, in
> intrepid I get a trace which I've attached.
>
> On windows, the code works, so I'm not sure if I'm doning something wrong
> or it's a PyQt bug.
>
> Thanks
> Nahuel
Hi again, 
It seems setMetaInformation caused the segfault.
Just casting it to python str solved the problem.

I've tried to isolate the problem in vain. Just if anyone has a strange 
segfault with a custom QTextDocument, wrapping metainformation data in str() 
may solve the issue.

Regards
Nahuel



More information about the PyQt mailing list