Bug 268905 - IllegalStateException: Can't dispose InputContext while it's active
IllegalStateException: Can't dispose InputContext while it's active
Status: VERIFIED FIXED
Product: cnd
Classification: Unclassified
Component: Debugger
8.2
All All
: P3 (vote)
: 8.2
Assigned To: Maria Tishkova
issues@cnd
EXCEPTIONS_REPORT, 82patch1-verified
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-11-09 09:13 UTC by Vladimir Kvashin
Modified: 2016-12-13 09:48 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (7.42 KB, text/plain)
2016-11-09 09:13 UTC, Vladimir Kvashin
Details
The code of InputContext.java that throws the exception (40.56 KB, text/plain)
2016-11-09 10:06 UTC, Vladimir Kvashin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Kvashin 2016-11-09 09:13:46 UTC
This issue was reported manually by vkvashin.
It already has 1 duplicates 


Build: NetBeans IDE 8.2 (Build 20161108-6cb00f1e6b8b)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.77-b03, Java(TM) SE Runtime Environment, 1.8.0_77-b03
OS: Linux

User Comments:
vkvashin: closed attach window




Stacktrace: 
java.lang.IllegalStateException: Can't dispose InputContext while it's active
   at sun.awt.im.InputContext.dispose(InputContext.java:666)
   at java.awt.Window$1DisposeAction.run(Window.java:1197)
   at java.awt.Window.doDispose(Window.java:1210)
   at java.awt.Dialog.doDispose(Dialog.java:1198)
   at java.awt.Window.dispose(Window.java:1151)
   at org.netbeans.modules.debugger.ui.actions.ConnectAction$ConnectListener.actionPerformed(ConnectAction.java:179)
Comment 1 Vladimir Kvashin 2016-11-09 09:13:48 UTC
Created attachment 162841 [details]
stacktrace
Comment 2 Vladimir Kvashin 2016-11-09 09:31:50 UTC
This is 100% reproducible. In CND or full IDE, try attaching with gdb.
Modify "Filter" field.
Close the attach window.
Exception occurs.
Comment 3 Vladimir Kvashin 2016-11-09 10:06:30 UTC
Created attachment 162843 [details]
The code of InputContext.java that throws the exception
Comment 4 Vladimir Kvashin 2016-11-09 10:12:53 UTC
The code that throws exception is 

public synchronized void dispose() {
    if (currentClientComponent != null) {
        throw new IllegalStateException("Can't dispose InputContext while it's active");
    }

Debugger shows that currentClientComponent is a text field. Its toString is 

javax.swing.JTextField[,56,16,326x18,layout=javax.swing.plaf.basic.BasicTextUI$UpdateHandler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@11d51e65,flags=296,maximumSize=,minimumSize=,preferredSize=,caretColor=sun.swing.PrintColorUIResource[r=51,g=51,b=51],disabledTextColor=javax.swing.plaf.ColorUIResource[r=184,g=207,b=229],editable=true,margin=javax.swing.plaf.InsetsUIResource[top=0,left=0,bottom=0,right=0],selectedTextColor=sun.swing.PrintColorUIResource[r=51,g=51,b=51],selectionColor=javax.swing.plaf.ColorUIResource[r=184,g=207,b=229],columns=0,columnWidth=0,command=,horizontalAlignment=LEADING]

I can 100% reproduce it on NB built from cnd-main with tip ecae8cddd8bb

It seems it does reproduce in release 8.2.
Comment 5 Vladimir Kvashin 2016-11-09 10:25:19 UTC
To reproduce, its enough just to change focus to "Filter" field. Then exception occurs. If you don't focus to the field, exception doesn't appear. If you change focus to the field, but then go to "Debugger" combo and reselect Gdb, exception does not happen (unless you focus the field after that)
Comment 6 Vladimir Kvashin 2016-11-10 11:02:15 UTC
I can not reproduce this, but if I set a breakpoint in RemoteDirectory.java:1161
i.e. here 

    private boolean isPendingDelivery(DirEntry entry) {
        String name = entry.getName();
        if (name.startsWith("#") && name.endsWith("#")) { // NOI18N
>>>         name = name.substring(1, name.length() - 1);

and when it hits, I remove remote cache for this directory,
I see that the same stack fragment is entered again and so on.
Comment 7 Martin Entlicher 2016-11-10 12:33:11 UTC
See http://bugs.java.com/view_bug.do?bug_id=4289940
"I ... recommend all users who face this exception to check their code for removeNotify() implementations."

This fixes the issue:
diff -r 264b33490767 cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/ui/processlist/AttachToProcessTopComponent.java
--- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/ui/processlist/AttachToProcessTopComponent.java	Wed Nov 09 18:13:56 2016 +0000
+++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/ui/processlist/AttachToProcessTopComponent.java	Thu Nov 10 14:32:51 2016 +0100
@@ -363,6 +363,7 @@
     @Override
     public void removeNotify() {
         updateContent(null);
+        super.removeNotify();
     }
Comment 8 Maria Tishkova 2016-11-15 12:58:05 UTC
thanks to Martin. 
fixed in enum release82 branch (will be transplanted to the trunk this week later)


changeset:   313318:e97e8a86c8af
branch:      release82
user:        Maria Dalmatova <mromashova@netbeans.org>
date:        Tue Nov 15 15:56:36 2016 +0300
summary:     fixed bz#268905 - IllegalStateException: Can't dispose InputContext while it's active
Comment 9 Quality Engineering 2016-11-23 03:19:08 UTC
Integrated into 'main-silver', will be available in build *201611230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/8e0bb9868d78
User: Maria Dalmatova <mromashova@netbeans.org>
Log: fixed bz#268905 - IllegalStateException: Can't dispose InputContext while it's active
(transplanted from e97e8a86c8afa2ba49e08278e6a395765fbb9e10)
Comment 10 soldatov 2016-12-13 09:48:56 UTC
Verified in NetBeans IDE 8.2 (Build 201612122312)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo