Bug 342947 - Klipper crashes when Shift is pressed
Summary: Klipper crashes when Shift is pressed
Status: RESOLVED FIXED
Alias: None
Product: klipper
Classification: Applications
Component: plasma-widget (show other bugs)
Version: 5.1.1
Platform: Compiled Sources Linux
: NOR grave
Target Milestone: ---
Assignee: Martin Flöser
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-17 08:23 UTC by Wattos
Modified: 2015-01-17 15:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposed Patch (1.76 KB, patch)
2015-01-17 08:37 UTC, Wattos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wattos 2015-01-17 08:23:48 UTC
Klipper crashes when any modifier key (with the exception of ALT) is pressed. This is because it enters into an infinite recursion.

This happens because Klipper popup delegates all events to its input field. The input field does not consume the event, so it is propagated to the parent widget, which is the popup. The popup tries to send the event to the input field again.

Reproducible: Always

Steps to Reproduce:
1. Open the Klipper popup (Using the shortcut)
2. Press Shift
3.

Actual Results:  
Klipper crashes

Expected Results:  
Klipper does not crash. Since klipper is now part of plasma, this bug kills the entire shell
Comment 1 Wattos 2015-01-17 08:37:23 UTC
Created attachment 90465 [details]
Proposed Patch

This patch fixes the problem
Comment 2 Martin Flöser 2015-01-17 08:43:07 UTC
Thanks for directly adding a patch :-) I wish all bug reports were that easy.

Small suggestion on the patch: use a local static variable for the recursion check.

Something like:
void KlipperPopup::keyPressEvent( QKeyEvent* e )  {
static QEvent *s_recursionCheck = nullptr;
if (s_recursionCheck == e) {
    s_recursionCheck = nullptr;
    return;
}
s_recursionCheck = e;
...

And may I ask to upload the patch to git.reviewboard.kde.org?
Comment 3 Wattos 2015-01-17 11:57:57 UTC
I really wanted to attach it to the review board, but it seems horribly slow. In addition, when I try to attach the diff it simply stays there forever. Exporting from Kdevelop causes an error as well.

As for the static, I prefer to avoid static variables. The variable s_recursionCheck is shared among all instances of KlipperPoppup. It may be the case that there is only one instance of the popup available at any given time, but that may change in the future. In general, I prefer to avoid statics if possible.

Having said that, since I am a "guest" I'll change it to use the static variable.

Is there any documentation on how I am supposed to use the review board? It is either broken, or it is very fragile and I am doing something wrong. I get a internal server error (500) when uploading my diff. That should never happen
Comment 4 Wattos 2015-01-17 12:00:14 UTC
OK, finally managed to add the review using the rbt tooling. 

Review on https://git.reviewboard.kde.org/r/122106/
Comment 5 David Edmundson 2015-01-17 14:33:25 UTC
Git commit c01ab8aa2a7e2b2deefea34950650daf57030673 by David Edmundson, on behalf of Filip Wieladek.
Committed on 17/01/2015 at 14:31.
Pushed by davidedmundson into branch 'master'.

Fix the infinite event recursion in the klipper popup.

Klipper crashes when any modifier key (with the exception of ALT) is pressed.

This is because it enters into an infinite recursion.
This happens because Klipper popup delegates all events to its input field.
The input field does not consume the event, so it is propagated to the parent widget,
which is the popup. The popup tries to send the event to the input field again.

Since klipper is now part of plasma, this bug kills the entire shell

REVIEW: 122106

M  +13   -2    klipper/klipperpopup.cpp
M  +5    -0    klipper/klipperpopup.h

http://commits.kde.org/plasma-workspace/c01ab8aa2a7e2b2deefea34950650daf57030673
Comment 6 David Edmundson 2015-01-17 15:18:14 UTC
Git commit cc6216a3f514d6696a884bb5b6617d62c3702d7f by David Edmundson, on behalf of Filip Wieladek.
Committed on 17/01/2015 at 14:31.
Pushed by davidedmundson into branch 'Plasma/5.2'.

Fix the infinite event recursion in the klipper popup.

Klipper crashes when any modifier key (with the exception of ALT) is pressed.

This is because it enters into an infinite recursion.
This happens because Klipper popup delegates all events to its input field.
The input field does not consume the event, so it is propagated to the parent widget,
which is the popup. The popup tries to send the event to the input field again.

Since klipper is now part of plasma, this bug kills the entire shell

REVIEW: 122106

M  +13   -2    klipper/klipperpopup.cpp
M  +5    -0    klipper/klipperpopup.h

http://commits.kde.org/plasma-workspace/cc6216a3f514d6696a884bb5b6617d62c3702d7f