[PATCH] Avoid crash in Konsole (TEWidget::setCursorPos)

Andras Mantia amantia at kde.org
Fri Sep 8 08:10:31 BST 2006


On Friday 08 September 2006 05:21, Robert Knight wrote:
> Hi,
>
> Forgot to mention - could you use gdb to find the values of the
> variables referenced in these two lines (just above the call to
> setMicroFocusHint) when the crash occurs:
>
>     ypos = bY + tLy + font_h*(cury-1) + font_a;
>     xpos = bX + tLx + font_w*curx;

I had a debug output displaying this. ;-) 
I get the following output:
TE: [TEWidget pointer (0xd84ae0) to widget libkonsolepart, 
geometry=150x70+0+0] xpos=2 ypos=-2 font_h=16 focus=false 
focusW[NewMainWindow pointer (0x6b8ea0) to widget MainWindow, 
geometry=800x600+0+39]

(does not crash here)

[...]
TE: [TEWidget pointer (0xda9c40) to widget libkonsolepart, 
geometry=150x70+0+0] xpos=2 ypos=-2 font_h=16 focus=false 
focusW[KMenuBar pointer (0x6bb690) to unnamed widget, 
geometry=800x31+0+0]


crashes here.

So ypos < 0 does not always crash, but "solves" the problem as it is -2 
in the second (crash) case as well. focus=false is the same issue, but 
I have more hints why the focus is the problem: when katepart crashes 
with a similar backtrace, the xpos and ypos used there is always valid, 
just the focus is different between a crash and normal way of working.

Before you ask why the focused widget is a KMenuBar in the second case: 
I don't know, but I changed the code to explicitely set the focus to 
the NewMainWindow before loading the part, and it still crashed with 
the following output:
TE: [TEWidget pointer (0x25c6e70) to widget libkonsolepart, 
geometry=150x70+0+0] xpos=2 ypos=-2 font_h=16 focus=false 
focusW[NewMainWindow pointer (0x6b8f60) to widget MainWindow, 
geometry=800x600+0+39]
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kdevelop path = <unknown> pid = 29684


BTW, if you search bugs.kde.org for reports containing QXMI you will see 
that the setMicroFocusHint crash affects not only Konsole, but KatePart 
and KOffice (KWord) as well, and nobody did anything solving the 
problem until now, so if nobody has better idea, I would like to see 
our applications not crash, even if it's not the true fix...

Andras
-- 
Quanta Plus developer - http://quanta.kdewebdev.org
K Desktop Environment - http://www.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060908/309dd7d2/attachment.sig>


More information about the kde-core-devel mailing list