gtk2 程式若讀取有些字元會crash

如果您覺得您的問題不屬於 debian desktop 或是 debian server 版的範圍內,請在這裡發問。

版主: mufa

gtk2 程式若讀取有些字元會crash

文章wsun013 » 週四 5月 04, 2006 2:06 pm

這個問題其實問了也不是, 因為小弟的 xorg 7 與 glib2/gtk2/pango/cairo 都是自己build 的, 可是還是死馬當活馬問了

一些gtk2 based 的程式, 像是 mousepad, leafpad, sylpheed-claws 如果讀到一些字元(除了英文字母外), 就會莫名奇妙 crash 並有下面的訊息

代碼: 選擇全部
The program 'mousepad' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadLength (poly request too large or internal Xlib length erro'.
  (Details: serial 1043 error_code 16 request_code 154 minor_code 20)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)


用 gdb 跑到 crash 後用 bt, 結果說 no stack

所以有幾個問題:
1. 大家有碰過類似的問題嗎, 我找google 大多是 gnome 的forum 才有這類的問題, 而從來沒有在 qt/kde based 的程式發生
2. 如果要讓 bt 有作用 (找的到stack?) 要將哪個程式的 debug 功能開啟呢?
gtk2 ? or glib2 ? or any others?

煩請大家指教
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GE d->++ s: a-- C+++>++++ UL>++++ P>++++ L++>++++ E---- W+ N@ o K- w++(+)
O- M- V? PS+++(+) PE++(+) Y-- PGP- t>--- 5? X+++ R- tv-(--) b+ DI? D+ G e++>++++
h+(!) r++(%) y*>++++
-------END GEEK CODE BLOCK-------
頭像
wsun013
快樂的大學生
快樂的大學生
 
文章: 784
註冊時間: 週二 9月 14, 2004 12:12 pm
來自: 紐西蘭

文章eliu » 週四 5月 04, 2006 3:12 pm

有時候程式會造成 stack corruption 所以無法顯示。

或者你可以用 valgrind 檢查
valgrind leafpad --sync
因為 gtk 會 buffer 住,有了 sync 就不會
頭像
eliu
可愛的小學生
可愛的小學生
 
文章: 44
註冊時間: 週六 8月 28, 2004 1:33 pm
來自: 新竹

文章wsun013 » 週四 5月 04, 2006 5:36 pm

太感謝eliu 兄了!
因為 ==29870== by 0x4534CD7: (within /usr/lib/libcairo.so.2.3.0)
所以我重編了 cairo 跟 pango 後
就沒再crash 了
又學了新的一課了 :finger1:

代碼: 選擇全部
The program 'leafpad' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadLength (poly request too large or internal Xlib length erro'.
  (Details: serial 56583 error_code 16 request_code 154 minor_code 20)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
==29870==
==29870== Invalid free() / delete / delete[]
==29870==    at 0x401D048: free (vg_replace_malloc.c:235)
==29870==    by 0x488701D: (within /lib/tls/libc-2.3.6.so)
==29870==    by 0x4886741: __libc_freeres (in /lib/tls/libc-2.3.6.so)
==29870==    by 0x401931E: _vgw_freeres (vg_preloaded.c:62)
==29870==    by 0x47A1475: exit (in /lib/tls/libc-2.3.6.so)
==29870==    by 0x43E40E8: (within /usr/lib/libgdk-x11-2.0.so.0.800.17)
==29870==    by 0x459C02E: _XError (XlibInt.c:2888)
==29870==    by 0x459DC0A: _XReply (XlibInt.c:1817)
==29870==    by 0x4594EF7: XSync (Sync.c:48)
==29870==    by 0x4595082: _XSyncFunction (Synchro.c:37)
==29870==    by 0x4557A94: XRenderAddGlyphs (in /usr/lib/libXrender.so.1.3.0)
==29870==    by 0x4534CD7: (within /usr/lib/libcairo.so.2.3.0)
==29870==  Address 0x4992000 is not stack'd, malloc'd or (recently) free'd
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GE d->++ s: a-- C+++>++++ UL>++++ P>++++ L++>++++ E---- W+ N@ o K- w++(+)
O- M- V? PS+++(+) PE++(+) Y-- PGP- t>--- 5? X+++ R- tv-(--) b+ DI? D+ G e++>++++
h+(!) r++(%) y*>++++
-------END GEEK CODE BLOCK-------
頭像
wsun013
快樂的大學生
快樂的大學生
 
文章: 784
註冊時間: 週二 9月 14, 2004 12:12 pm
來自: 紐西蘭


回到 debian misc

誰在線上

正在瀏覽這個版面的使用者:Google [Bot] 和 1 位訪客