Project

General

Profile

Bug #6241

NPE in LinuxKeyboardReader when Escape is pressed

Added by Vladimir Tsichevski about 2 years ago. Updated about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:

History

#1 Updated by Vladimir Tsichevski about 2 years ago

  1. Open any application with a window in ChUI Swing.
  2. Press Escape. Client crashes with NPE.

The stack trace:

    LinkedBlockingQueue<E>.offer(E) line: 411    
    LinkedBlockingQueue<E>(AbstractQueue<E>).add(E) line: 95    
    LinuxKeyboardReader.keyPressed(KeyEvent) line: 214    
    ChuiClient(Component).processKeyEvent(KeyEvent) line: 6497    
    ChuiClient(Component).processEvent(AWTEvent) line: 6316    
    ChuiClient(Container).processEvent(AWTEvent) line: 2239    
    ChuiClient(Window).processEvent(AWTEvent) line: 2025

The reason: null is explicitly inserted in LinkedBlockingQueue, which does not support this.

The offending code in LinuxKeyboardReader.keyPressed(KeyEvent) is::

      if (key == KeyEvent.VK_ESCAPE)
      {
         // toggle the flag
         escPressed = !escPressed;

         queue.add(null);
                   ^^^^^
         return;
      }

Also available in: Atom PDF