GNOME Bugzilla – Bug 346464
gedit crashes when LDTP gettextproperty is used on text that is underlined in squiggly lines
Last modified: 2006-09-14 10:42:26 UTC
Please describe the problem: In gedit, when automatic spell checking is on, misspelled words are underlined with a squiggly red line.. When you try to get properties of such text using gettextproperty() function, gedit crashes. Steps to reproduce: 1. Enable automatic spell checking in gedit (Enable spell-checker plugin in edit->preferences, and then enable the checking in tools->automatic spell checking). 2. Type some misspelled word like teh. Gedit will underline the word in red 3. Open a python shell, and give the commands from ldtp import * and then gettextproperty('*gedit','txt0',0,2) (assuming you typed teh in a new document.If not, change parameters accordingly) Actual results: Gedit crashes, and gettextproperty returns a "Unable to get property" Expected results: Some or no output from gettextproperty(Not "unable to get property"). Atleast, gedit should not crash. Does this happen every time? Yes, everytime Other information:
Srinivas: Attach gedit crash report with debugging symbols.
My gedit was not compiled with debugging symbols .. Here is the stack trace : http://pastebin.ca/84711
Thanks to Srinivas for getting this trace:
+ Trace 69270
Thread 1 (process 7164)
Steps to reproduce the bug using LDTP scripts: from ldtp import * selectmenuitem ('*-gedit', 'mnuEdit;mnuPreferences') waittillguiexist ('dlgPreferences') selecttab ('dlgPreferences', 'ptl0', 'Plugins') checkrow ('dlgPreferences', 'tbl1', 9) # Assuming that 'Spell Checker' is 10th plugin click ('dlgPreferences', 'btnClose') waittillguinotexist ('dlgPreferences') menucheck ('*-gedit', 'mnuTools;mnuAutocheckSpelling') settextvalue ('*-gedit', 'txt0', 'catchbugs byusing ldtp') gettextproperty('*gedit','txt0',0,8) To install LDTP package: http://ldtp.freedesktop.org/wiki/Downloads
>settextvalue ('*-gedit', 'txt0', 'catchbugs byusing ldtp') >gettextproperty('*gedit','txt0',0,8) Nagappan, can you explain the last two lines? I don't know what API calls this corresponds to (i.e. what settextvalue is doing). Knowing that will help me evaluate whether the assertion is correct.
Bill: settextvalue function internally calls Accessible_isEditableText and if its true, AccessibleEditableText_setTextContents function is called. In gettextproperty, AccessibleText_getAttributes function is called to get the text properties. Additional info: We have added this comment in our code. /* AccessibleText_getAttributes doesn't seem to be taking the end position i.e. the diff value into account. It only checks from the start position */ So, we are calling this way text_prop = AccessibleText_getAttributes (accessibleText, start_pos, &zero, &diff); Here, start_pos = zero = 0; end position is 8 with this example. diff = end_pos - start_pos;
This doesn't look like gedit fault. Moving to atk.
Found the problem; it turns out that ATK checks the value of the underline attribute in GTK+. Current code throws assert if PANGO_UNDERLINE_ERROR is found, but PANGO_UNDERLINE_ERROR doesn't mean "error condition hit" but rather means "underline style used to indicate possible error", i.e. mis-spelled word. Fixing in cvs.