[pydocview] Segmentation fault when opening two SDI views with the same document

Klaus Nowikow klaus.nowikow at tuwien.ac.at
Mon Oct 1 06:18:13 PDT 2007


Hi!

In my application I'd like to be be able to open two or more
views with one document. I had some problems with this, so I
tried to change the pydocview demo in the samples folder to
open two views instead of one by changing these lines in
TextEditorApplication.OnInit():

if not docManager.GetDocuments() and docManager.GetFlags() & wx.lib.docview.DOC_SDI:
    textTemplate.CreateDocument('', docview.DOC_NEW).OnNewDocument()

to:

if not docManager.GetDocuments() and docManager.GetFlags() & wx.lib.docview.DOC_SDI:
    doc = textTemplate.CreateDocument('', wx.lib.docview.DOC_NEW)
    doc.OnNewDocument()
    textTemplate.CreateView(doc, 0)

I now get two windows, but when I close both of them (not with File/Exit, but using
the window's Close button, the one that's top right in Windows) I get a segmentation
fault. Is this the wrong way to open multiple views for a single document?

I am using wxpython 2.6.3.3 on Gentoo Linux.

Regards,

Klaus





More information about the wxpython-users mailing list