Summary: | deattach/attach session -> key input is doubled | ||
---|---|---|---|
Product: | [Applications] konsole | Reporter: | Jan Spitalnik <spitalnik> |
Component: | general | Assignee: | Simon Hausmann <hausmann> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | konsole-devel |
Priority: | VHI | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
patch to fix invalid reads when attaching session
fix slot declaration |
Description
Jan Spitalnik
2002-10-14 23:52:31 UTC
Cannot reproduce this. Which steps did you leave out (obviously at least the one creating a second session) to make it reproducible? :-) Subject: Re: deattach/attach session -> key input is doubled
On Tue, Oct 15, 2002 ve 05:46:48PM -0000, Stephan Binner wrote:
> Cannot reproduce this. Which steps did you leave out (obviously at least the
> one creating a second session) to make it reproducible? :-)
oops, okey, start konsole, create two sessions, deattach/attach one of them
-> double-chars :) CVS(14.10.2002)
Ok, I can reproduce this - but only with current qt-copy, Qt 3.0.6 works fine. Can you confirm that you use qt-copy (and why doesn't ask the bug system this)? Subject: Re: deattach/attach session -> key input is doubled Dne st 16. http://lists.kde.org/?l=konsole-devel&m=103512276507858&w=2 has a work-around patch for use with qt-copy, thanks. :-) But better try to find this subtle bug as long there is time left before it bugs us again somewhere else. Tronical, do you succeed in creating a simple test case for TrollTech? :-) Created attachment 225 [details]
patch to fix invalid reads when attaching session
While debugging (it looks indeed like a Qt bug) I noticed that when attaching the KonsoleChild destructor deletes the TEWidget object before emitting the doneChild signal. the signal emission leads to attachSession and somewhen it ends up in TEmulation::changeGUI . At this point the gui member variable is a dangling pointer because the TEWidget is already dead. See attached patch for a fix for the invalid reads caused by that. (nope, that doesn't fix this bug, it's just a side-effect :) Created attachment 236 [details]
fix slot declaration
This patch fixes the slot declaration to make the connection in the base class
constructor use the same slot when disconnecting later (when the TEmuVt102
class) is ininitialized.
OK, turned out not to be a real Qt bug. TEmulation declares the onKeyPress slot. TEmuVt102's
declares the slot again, so the slot is listed twice, once in TEmulation's QMetaObject and once in
TEmuVt102's one. But as the TEmulation constructor calls connectGUI at this time only the
onKeyPressed slot of TEmulation is avaiable, because the vtbl of the object is not adjusted to
TEmuVt102 yet, so the metaObject method still returns TEmulations' QMetaObject. As a result in
the sender object the member index of TEmulation's onKeyPressed signal is stored (in the
connection list) .
At run-time it doesn't make a difference as the slot method was marked virtual.
But when disconnecting metaObject() returns TEmuVt102's metaobject and there disconnect
immediately finds the onKeyPressed slot and tries to disconnect that one. It fails however as the
member index is different to the one in the base class.
The fact that it worked with Qt 3.0.x I would call a fortune or something like relying on undefined
behaviour :)
Attachment 2 [details] fixes the bug.
Konsole developers, please approve both patches :)
Ouch, thanks for your efforts. Please commit the patches. Subject: kdebase/konsole/konsole CVS commit by hausmann: - fixed an invalid read when attaching a detached session - fixed keyPress signal/slot connection when detaching and re-attaching a session See #49153 for details about both patches. Approved by Beineri CCMAIL: 49153-done@bugs.kde.org M +7 -5 TEmuVt102.cpp 1.95 M +1 -1 TEmuVt102.h 1.33 M +23 -21 TEmulation.cpp 1.45 M +2 -1 TEmulation.h 1.27 |