[PyQt] Segmentation Fault working with QTextDocument/QTextEdit
Nahuel Defossé
nahueldefosse at yahoo.com.ar
Tue Jan 13 19:32:28 GMT 2009
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dump_intrepid.txt
Type: text/x-diff
Size: 4643 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090113/3b67300d/dump_intrepid-0001.bin
-------------- next part --------------
Es null? False
*** Opening /home/defo/Escritorio/CrossMates/editor.py ***
Opening PyQt4.QtCore.QUrl("file:///home/defo/Escritorio/CrossMates/editor.py")
Setting custom document
Can't handle PyQt4.QtCore.QUrl("file:///home/defo/Escritorio/CrossMates/editor.py")
Setting custom document
Loading document
Setting title
Title set
Document loaded
*** glibc detected *** python: malloc(): memory corruption (fast): 0x0933d6e9 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7ddb962]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x8d)[0xb7ddccad]
/usr/lib/libstdc++.so.6(_Znwj+0x27)[0xb78a4447]
/usr/lib/libQtGui.so.4(_ZNK7QRegion4copyEv+0x13f)[0xb68d3bcf]
/usr/lib/libQtGui.so.4(_ZN7QRegion6detachEv+0x5f)[0xb68d3cdf]
/usr/lib/libQtGui.so.4(_ZNK7QRegion8subtractERKS_+0xc1)[0xb68d4771]
/usr/lib/libQtGui.so.4(_ZNK7QRegionmiERKS_+0x30)[0xb68d4830]
/usr/lib/libQtGui.so.4(_ZN7QRegionmIERKS_+0x33)[0xb68d4883]
/usr/lib/libQtGui.so.4(_ZNK15QPlastiqueStyle13drawPrimitiveEN6QStyle16PrimitiveElementEPK12QStyleOptionP8QPainterPK7QWidget+0x44cf)[0xb6a8f92f]
/usr/lib/libQtGui.so.4[0xb6a4d729]
/usr/lib/libQtGui.so.4(_ZN10QTabWidget10paintEventEP11QPaintEvent+0xba)[0xb6b99d1a]
/usr/lib/python2.5/site-packages/PyQt4/QtGui.so[0xb71920b6]
/usr/lib/python2.5/site-packages/PyQt4/QtGui.so[0xb7192168]
python(PyEval_EvalFrameEx+0x5d13)[0x80c9ab3]
python(PyEval_EvalCodeEx+0x6e7)[0x80cb1f7]
python[0x811372e]
python(PyObject_Call+0x27)[0x805cb97]
python[0x8062bfb]
python(PyObject_Call+0x27)[0x805cb97]
python(PyEval_CallObjectWithKeywords+0x6c)[0x80c2e9c]
/usr/lib/python2.5/site-packages/sip.so[0xb7b39cfe]
/usr/lib/python2.5/site-packages/PyQt4/QtGui.so[0xb70d099b]
/usr/lib/python2.5/site-packages/PyQt4/QtGui.so[0xb7194e38]
/usr/lib/libQtGui.so.4(_ZN7QWidget5eventEP6QEvent+0x95b)[0xb67e84cb]
/usr/lib/libQtGui.so.4(_ZN10QTabWidget5eventEP6QEvent+0x33)[0xb6b99313]
/usr/lib/python2.5/site-packages/PyQt4/QtGui.so[0xb71926c2]
/usr/lib/libQtGui.so.4(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0xbc)[0xb6790c8c]
/usr/lib/libQtGui.so.4(_ZN12QApplication6notifyEP7QObjectP6QEvent+0x198)[0xb67959d8]
/usr/lib/python2.5/site-packages/PyQt4/QtGui.so[0xb74b2793]
/usr/lib/libQtCore.so.4(_ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent+0xa9)[0xb7a201a9]
/usr/lib/libQtGui.so.4[0xb67eec5e]
/usr/lib/libQtGui.so.4(_ZN14QWidgetPrivate10drawWidgetEP12QPaintDeviceRK7QRegionRK6QPointiP8QPainter+0x5df)[0xb67e2d6f]
/usr/lib/libQtGui.so.4(_ZN14QWidgetPrivate22paintSiblingsRecursiveEP12QPaintDeviceRK5QListIP7QObjectEiRK7QRegionRK6QPointiP8QPainter+0x38a)[0xb67e34fa]
/usr/lib/libQtGui.so.4(_ZN14QWidgetPrivate10drawWidgetEP12QPaintDeviceRK7QRegionRK6QPointiP8QPainter+0x196)[0xb67e2926]
/usr/lib/libQtGui.so.4[0xb6948527]
/usr/lib/libQtGui.so.4[0xb6948cc7]
/usr/lib/libQtGui.so.4(_ZN7QWidget5eventEP6QEvent+0x56f)[0xb67e80df]
/usr/lib/libQtGui.so.4(_ZN11QMainWindow5eventEP6QEvent+0x65)[0xb6b41045]
/usr/lib/python2.5/site-packages/PyQt4/QtGui.so[0xb731b774]
/usr/lib/libQtGui.so.4(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0xbc)[0xb6790c8c]
/usr/lib/libQtGui.so.4(_ZN12QApplication6notifyEP7QObjectP6QEvent+0x198)[0xb67959d8]
/usr/lib/python2.5/site-packages/PyQt4/QtGui.so[0xb74b2793]
/usr/lib/libQtCore.so.4(_ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent+0xa9)[0xb7a201a9]
/usr/lib/libQtCore.so.4(_ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData+0x2a9)[0xb7a21559]
/usr/lib/libQtCore.so.4(_ZN16QCoreApplication16sendPostedEventsEP7QObjecti+0x2d)[0xb7a2177d]
/usr/lib/libQtCore.so.4[0xb7a4b68f]
/usr/lib/libglib-2.0.so.0(g_main_context_dispatch+0x176)[0xb7763cc6]
/usr/lib/libglib-2.0.so.0[0xb7767083]
/usr/lib/libglib-2.0.so.0(g_main_context_iteration+0x6e)[0xb776763e]
/usr/lib/libQtCore.so.4(_ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x58)[0xb7a4ba58]
/usr/lib/libQtGui.so.4[0xb6824e95]
/usr/lib/libQtCore.so.4(_ZN10QEventLoop13processEventsE6QFlagsINS_17ProcessEventsFlagEE+0x4d)[0xb7a1f42d]
/usr/lib/libQtCore.so.4(_ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE+0x9d)[0xb7a1f5bd]
/usr/lib/libQtCore.so.4(_ZN16QCoreApplication4execEv+0xad)[0xb7a2183d]
/usr/lib/libQtGui.so.4(_ZN12QApplication4execEv+0x27)[0xb6790587]
/usr/lib/python2.5/site-packages/PyQt4/QtGui.so[0xb74b35c9]
python(PyEval_EvalFrameEx+0x5d13)[0x80c9ab3]
python(PyEval_EvalCodeEx+0x6e7)[0x80cb1f7]
python(PyEval_EvalFrameEx+0x565e)[0x80c93fe]
python(PyEval_EvalCodeEx+0x6e7)[0x80cb1f7]
python(PyEval_EvalCode+0x57)[0x80cb347]
python(PyRun_FileExFlags+0xf8)[0x80ea818]
python(PyRun_SimpleFileExFlags+0x199)[0x80eaab9]
======= Memory map: ========
08048000-08140000 r-xp 00000000 08:05 2467799 /usr/bin/python2.5
08140000-08165000 rw-p 000f7000 08:05 2467799 /usr/bin/python2.5
08165000-0816b000 rw-p 08165000 00:00 0
08c98000-0945e000 rw-p 08c98000 00:00 0 [heap]
b4778000-b4779000 ---p b4778000 00:00 0
b4779000-b4f79000 rw-p b4779000 00:00 0
b4f79000-b5000000 r--p 00000000 08:05 2638683 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
b5000000-b5021000 rw-p b5000000 00:00 0
b5021000-b5100000 ---p b5021000 00:00 0
b515e000-b515f000 ---p b515e000 00:00 0
b515f000-b595f000 rw-p b515f000 00:00 0
b595f000-b5968000 r-xp 00000000 08:05 1531937 /lib/tls/i686/cmov/libnss_files-2.7.so
b5968000-b596a000 rw-p 00008000 08:05 1531937 /lib/tls/i686/cmov/libnss_files-2.7.so
b596a000-b597e000 r-xp 00000000 08:05 1531934 /lib/tls/i686/cmov/libnsl-2.7.so
b597e000-b5980000 rw-p 00013000 08:05 1531934 /lib/tls/i686/cmov/libnsl-2.7.so
b5980000-b5982000 rw-p b5980000 00:00 0
b5982000-b5989000 r-xp 00000000 08:05 1531935 /lib/tls/i686/cmov/libnss_compat-2.7.so
b5989000-b598b000 rw-p 00006000 08:05 1531935 /lib/tls/i686/cmov/libnss_compat-2.7.so
b59a5000-b59b6000 r--p 00000000 08:05 2511294 /usr/local/share/fonts/MONACO.ttf
b59b6000-b59b7000 rw-p b59b6000 00:00 0
b59b7000-b5a48000 r--p 00000000 08:05 2638682 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
b5a48000-b5a57000 r-xp 00000000 08:05 265863 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_xcf.so
b5a57000-b5a58000 rw-p 0000e000 08:05 265863 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_xcf.so
b5a58000-b5a5c000 rw-p b5a58000 00:00 0
b5a5c000-b5aa0000 r-xp 00000000 08:05 2470352 /usr/lib/libjasper.so.1.0.0
b5aa0000-b5aa3000 rw-p 00044000 08:05 2470352 /usr/lib/libjasper.so.1.0.0
b5aa3000-b5aa9000 rw-p b5aa3000 00:00 0
b5aa9000-b5aeb000 r-xp 00000000 08:05 2470358 /usr/lib/libHalf.so.2.0.2
b5aeb000-b5aec000 rw-p 00041000 08:05 2470358 /usr/lib/libHalf.so.2.0.2
b5aec000-b5b61000 r-xp 00000000 08:05 2470360 /usr/lib/libIlmImf.so.2.0.2
b5b61000-b5b63000 rw-p 00074000 08:05 2470360 /usr/lib/libIlmImf.so.2.0.2
b5b67000-b5b6f000 r-xp 00000000 08:05 1531939 /lib/tls/i686/cmov/libnss_nis-2.7.so
b5b6f000-b5b71000 rw-p 00007000 08:05 1531939 /lib/tls/i686/cmov/libnss_nis-2.7.so
b5b71000-b5b75000 r-xp 00000000 08:05 265861 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_xview.so
b5b75000-b5b76000 rw-p 00004000 08:05 265861 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_xview.so
b5b76000-b5b7c000 r-xp 00000000 08:05 265859 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_tga.so
b5b7c000-b5b7d000 rw-p 00005000 08:05 265859 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_tga.so
b5b7d000-b5b87000 r-xp 00000000 08:05 265862 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_rgb.so
b5b87000-b5b88000 rw-p 0000a000 08:05 265862 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_rgb.so
b5b88000-b5b8d000 r-xp 00000000 08:05 265857 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_psd.so
b5b8d000-b5b8e000 rw-p 00004000 08:05 265857 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_psd.so
b5b8e000-b5bd4000 r-xp 00000000 08:05 2183725 /usr/lib/libQtXml.so.4.4.3
b5bd4000-b5bd6000 rw-p 00045000 08:05 2183725 /usr/lib/libQtXml.so.4.4.3
b5bd6000-b5c44000 r-xp 00000000 08:05 2471768 /usr/lib/libQtDBus.so.4.4.3
b5c44000-b5c46000 rw-p 0006d000 08:05 2471768 /usr/lib/libQtDBus.so.4.4.3
b5c46000-b5d48000 r-xp 00000000 08:05 2471784 /usr/lib/libQtNetwork.so.4.4.3
b5d48000-b5d4c000 rw-p 00101000 08:05 2471784 /usr/lib/libQtNetwork.so.4.4.3
b5d4c000-b5f13000 r-xp 00000000 08:05 134826 /usr/lib/kde4/lib/libkdecore.so.5.1.0
b5f13000-b5f1c000 rw-p 001c7000 08:05 134826 /usr/lib/kde4/lib/libkdecore.so.5.1.0
b5f1c000-b5f6d000 r-xp 00000000 08:05 2048116 /usr/lib/libtiff.so.4.2.1
b5f6d000-b5f6f000 rw-p 00050000 08:05 2048116 /usr/lib/libtiff.so.4.2.1
b5f6f000-b5f9b000 r-xp 00000000 08:05 1933636 /usr/lib/liblcms.so.1.0.16
b5f9b000-b5f9c000 rw-p 0002b000 08:05 1933636 /usr/lib/liblcms.so.1.0.16
b5f9c000-b5f9f000 rw-p b5f9c000 00:00 0
b5f9f000-b600a000 r-xp 00000000 08:05 2470289 /usr/lib/libmng.so.1.1.0.9
b600a000-b600d000 rw-p 0006a000 08:05 2470289 /usr/lib/libmng.so.1.1.0.9
b600d000-b6015000 r-xp 00000000 08:05 265855 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_pcx.so
b6015000-b6016000 rw-p 00008000 08:05 265855 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_pcx.so
b6016000-b601b000 r-xp 00000000 08:05 265858 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_jp2.so
b601b000-b601c000 rw-p 00005000 08:05 265858 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_jp2.so
b601c000-b6030000 r-xp 00000000 08:05 2470359 /usr/lib/libIex.so.2.0.2
b6030000-b6032000 rw-p 00013000 08:05 2470359 /usr/lib/libIex.so.2.0.2
b6032000-b6037000 r-xp 00000000 08:05 262236 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_exr.so
b6037000-b6038000 rw-p 00005000 08:05 262236 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_exr.so
b6038000-b6057000 r-xp 00000000 08:05 2469606 /usr/lib/libjpeg.so.62.0.0
b6057000-b6058000 rw-p 0001e000 08:05 2469606 /usr/lib/libjpeg.so.62.0.0
b6058000-b60a5000 r-xp 00000000 08:05 2183739 /usr/lib/libQtSvg.so.4.4.3
b60a5000-b60a7000 rw-p 0004c000 08:05 2183739 /usr/lib/libQtSvg.so.4.4.3
b60a7000-b60ae000 r-xp 00000000 08:05 265860 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_eps.so
b60ae000-b60af000 rw-p 00007000 08:05 265860 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_eps.so
b60af000-b60be000 r-xp 00000000 08:05 1532030 /lib/libbz2.so.1.0.4
b60be000-b60bf000 rw-p 0000f000 08:05 1532030 /lib/libbz2.so.1.0.4
b60bf000-b60c6000 r-xp 00000000 08:05 265856 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_dds.so
b60c6000-b60c7000 rw-p 00006000 08:05 265856 /usr/lib/kde4/lib/kde4/plugins/imageformats/kimg_dds.so
b60c7000-b60cb000 r-xp 00000000 08:05 753726 /usr/lib/qt4/plugins/imageformats/libqtiff.so
b60cb000-b60cc000 rw-p 00003000 08:05 753726 /usr/lib/qt4/plugins/imageformats/libqtiff.so
b60cc000-b60d1000 r-xp 00000000 08:05 1212435 /usr/lib/qt4/plugins/imageformats/libqmng.so
b60d1000-b60d2000 rw-p 00004000 08:05 1212435 /usr/lib/qt4/plugins/imageformats/libqmng.so
b60d2000-b60d4000 r-xp 00000000 08:05 2470159 /usr/lib/libXinerama.so.1.0.0
b60d4000-b60d5000 rw-p 00001000 08:05 2470159 /usr/lib/libXinerama.so.1.0.0
b60d5000-b60dd000 r-xp 00000000 08:05 2470155 /usr/lib/libXcursor.so.1.0.2
b60dd000-b60de000 rw-p 00007000 08:05 2470155 /usr/lib/libXcursor.so.1.0.2
b60de000-b60e2000 r-xp 00000000 08:05 2470058 /usr/lib/libXfixes.so.3.1.0
b60e2000-b60e3000 rw-p 00003000 08:05 2470058 /usr/lib/libXfixes.so.3.1.0
b60e3000-b60e4000 rw-p b60e3000 00:00 0
b60e4000-b60e7000 r-xp 00000000 08:05 753724 /usr/lib/qt4/plugins/imageformats/libqsvg.so
b60e7000-b60e8000 rw-p 00003000 08:05 753724 /usr/lib/qt4/plugins/imageformats/libqsvg.so
b60e8000-b60f1000 r-xp 00000000 08:05 1212440 /usr/lib/qt4/plugins/imageformats/libqjpeg.so
b60f1000-b60f2000 rw-p 00008000 08:05 1212440 /usr/lib/qt4/plugins/imageformats/libqjpeg.so
b60f2000-b60f8000 r-xp 00000000 08:05 753725 /usr/lib/qt4/plugins/imageformats/libqico.so
b60f8000-b60f9000 rw-p 00005000 08:05 753725 /usr/lib/qt4/plugins/imageformats/libqico.so
b60f9000-b60fe000 r-xp 00000000 08:05 1212436 /usr/lib/qt4/plugins/imageformats/libqgif.so
b60fe000-b60ff000 rw-p 00005000 08:05 1212436 /usr/lib/qt4/plugins/imageformats/libqgif.so
b60ff000-b6107000 r-xp 00000000 08:05 2761815 /usr/lib/qt4/plugins/iconengines/libqsvgicon.so
b6107000-b6108000 rw-p 00008000 08:05 2761815 /usr/lib/qt4/plugins/iconengines/libqsvgicon.so
b6108000-b610d000 r-xp 00000000 08:05 1278045 /usr/lib/qt4/plugins/inputmethods/libqimsw-multi.so
b610d000-b610e000 rw-p 00004000 08:05 1278045 /usr/lib/qt4/plugins/inputmethods/libqimsw-multi.so
b610e000-b6114000 r--s 00000000 08:05 2778005 /var/cache/fontconfig/945677eb7aeaf62f1d50efc3fb3ec7d8-x86.cache-2
b6114000-b6117000 r--s 00000000 08:05 2781432 /var/cache/fontconfig/e383d7ea5fbe662a33d9b44caf393297-x86.cache-2
b6117000-b6118000 r--s 00000000 08:05 2781431 /var/cache/fontconfig/c69f04ab05004e31a6d5e715764f16d8-x86.cache-2
b6118000-b611b000 r--s 00000000 08:05 2781430 /var/cache/fontconfig/6eb3985aa4124903f6ff08ba781cd364-x86.cache-2
b611b000-b611c000 r--s 00000000 08:05 2781429 /var/cache/fontconfig/4c73fe0c47614734b17d736dbde7580a-x86.cache-2
b611c000-b611f000 r--s 00000000 08:05 2781426 /var/cache/fontconfig/a755afe4a08bf5b97852ceb7400b47bc-x86.cache-2
b611f000-b6126000 r--s 00000000 08:05 2781197 /var/cache/fontconfig/6d41288fd70b0be22e8c3a91e032eec0-x86.cache-2
b6126000-b6129000 r--s 00000000 08:05 2781196 /var/cache/fontconfig/de156ccd2eddbdc19d37a45b8b2aac9c-x86.cache-2
b6129000-b6131000 r--s 00000000 08:05 2781195 /var/cache/fontconfig/e3de0de479f42330eadf588a55fb5bf4-x86.cache-2
b6131000-b6139000 r--s 00000000 08:05 2781194 /var/cache/fontconfig/0f34bcd4b6ee430af32735b75db7f02b-x86.cache-2
b6139000-b613a000 r--s 00000000 08:05 2781193 /var/cache/fontconfig/9451a55048e8dbe8633e64d34165fdf2-x86.cache-2
b613a000-b62bf000 r--s 00000000 08:05 2778863 /var/cache/fontconfig/a63a1054d861b037daf75f3d71eeedc9-x86.cache-2
b62bf000-b62c0000 r--s 00000000 08:05 2778702 /var/cache/fontconfig/4794a0821666d79190d59a36cb4f44b5-x86.cache-2
b62c0000-b62e2000 r--s 00000000 08:05 2778074 /var/cache/fontconfig/365b55f210c0a22e9a19e35191240f32-x86.cache-2
b62e2000-b62e5000 r--s 00000000 08:05 2778017 /var/cache/fontconfig/de9486f0b47a4d768a594cb4198cb1c6-x86.cache-2
b62e5000-b62ec000 r--s 00000000 08:05 2778016 /var/cache/fontconfig/d52a8644073d54c13679302ca1180695-x86.cache-2
b62ec000-b62f1000 r--s 00000000 08:05 2778001 /var/cache/fontconfig/105b9c7e6f0a4f82d8c9b6e39c52c6f9-x86.cache-2
b62f1000-b62fa000 r--s 00000000 08:05 2777966 /var/cache/fontconfig/089dead882dea3570ffc31a9898cfb69-x86.cache-2
b62fa000-b62fc000 r--s 00000000 08:05 2777698 /var/cache/fontconfig/e13b20fdb08344e0e664864cc2ede53d-x86.cache-2
b6zsh: abort python main.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: code.7z
Type: application/x-7z
Size: 51640 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090113/3b67300d/code-0001.bin
More information about the PyQt
mailing list