Project

General

Profile

Bug #2707

Bug #2677: fix drawing and functional differences between P2J GUI and 4GL GUI

menu/simple_sm.p causes an infinite loop where the window flashes and the OS is nearly unusable

Added by Greg Shah over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Vadim Gindin
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

Related issues

Related to User Interface - Bug #2736: fix GUI menu drawing problems in menu/simple_sm.p Closed

History

#1 Updated by Greg Shah over 8 years ago

This can be recreated in the trunk revision 10935 by running the menu/simple_sm.p using the Swing client. Be prepared to kill the session using something like the task manager, it can't be killed any other way. The system is nearly unusable until you can kill the app.

#2 Updated by Constantin Asofiei over 8 years ago

This one is fixed in 1811q rev 11003 - it was a NPE in FontManager.getTextWidth.

#3 Updated by Greg Shah over 8 years ago

This still occurs for me on 1811q revision 11008. You don't see it? Could there be a change on your system that is not committed into the branch?

#4 Updated by Constantin Asofiei over 8 years ago

I was using a modified version of simple_sm.p, the root cause is this:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:76)
    at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:694)
    at com.goldencode.p2j.net.Conversation.block(Conversation.java:319)
    at com.goldencode.p2j.net.Conversation.waitMessage(Conversation.java:257)
    at com.goldencode.p2j.net.Queue.transactImpl(Queue.java:1128)
    at com.goldencode.p2j.net.Queue.transact(Queue.java:585)
    at com.goldencode.p2j.net.BaseSession.transact(BaseSession.java:223)
    at com.goldencode.p2j.net.HighLevelObject.transact(HighLevelObject.java:163)
    at com.goldencode.p2j.net.RemoteObject$RemoteAccess.invokeCore(RemoteObject.java:1425)
    at com.goldencode.p2j.net.InvocationStub.invoke(InvocationStub.java:97)
    at com.sun.proxy.$Proxy4.standardEntry(Unknown Source)
    at com.goldencode.p2j.main.ClientCore.start(ClientCore.java:277)
    at com.goldencode.p2j.main.ClientCore.start(ClientCore.java:100)
    at com.goldencode.p2j.main.ClientDriver.start(ClientDriver.java:201)
    at com.goldencode.p2j.main.CommonDriver.process(CommonDriver.java:398)
    at com.goldencode.p2j.main.ClientDriver.process(ClientDriver.java:1)
    at com.goldencode.p2j.main.ClientDriver.main(ClientDriver.java:267)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    at java.lang.String.charAt(String.java:658)
    at com.goldencode.p2j.ui.client.MenuItem$Label.init(MenuItem.java:403)
    at com.goldencode.p2j.ui.client.gui.MenuItemGuiImpl$GuiLabel.init(MenuItemGuiImpl.java:683)
    at com.goldencode.p2j.ui.client.MenuItem.afterConfigUpdate(MenuItem.java:123)
    at com.goldencode.p2j.ui.client.MenuItem.afterConfigUpdate(MenuItem.java:1)
    at com.goldencode.p2j.ui.ConfigSyncManager.markScopeEnd(ConfigSyncManager.java:247)
    at com.goldencode.p2j.ui.ConfigManager.syncConfigChanges(ConfigManager.java:497)
    at com.goldencode.p2j.ui.ConfigManager.replaceConfig(ConfigManager.java:365)
    at com.goldencode.p2j.ui.client.MenuItem.initialize(MenuItem.java:69)
    at com.goldencode.p2j.ui.client.gui.MenuItemGuiImpl.initialize(MenuItemGuiImpl.java:186)
    at com.goldencode.p2j.ui.client.MenuItem.initialize(MenuItem.java:1)
    at com.goldencode.p2j.ui.client.WidgetRegistry.reconstructWidget(WidgetRegistry.java:126)
    at com.goldencode.p2j.ui.client.WidgetRegistry.pushMenuDescription(WidgetRegistry.java:425)
    at com.goldencode.p2j.ui.chui.ThinClient$18.run(ThinClient.java:7195)
    at com.goldencode.p2j.ui.chui.ThinClient.eventBracket(ThinClient.java:13510)
    at com.goldencode.p2j.ui.chui.ThinClient.eventDrawingBracket(ThinClient.java:13459)
    at com.goldencode.p2j.ui.chui.ThinClient.pushMenuDescription(ThinClient.java:7190)
    ... 21 more

#5 Updated by Greg Shah over 8 years ago

Vadim: could you look at this?

It looks like this problem can occur when the MenuItem.Label.init() is passed the empty string:

         this.prepLabel = result.toString();

         if (!mnemonicAssigned)
         {
            this.mnemonic = this.prepLabel.charAt(0);
            this.mnemIdx = 0;
         }

Is the empty string a valid case?

If so, then how does the 4GL handle the mnemonic in that case?

#6 Updated by Vadim Gindin over 8 years ago

Greg Shah wrote:

Vadim: could you look at this?

It looks like this problem can occur when the MenuItem.Label.init() is passed the empty string:

[...]

Is the empty string a valid case?

If so, then how does the 4GL handle the mnemonic in that case?

Theoretically prepLabel can be empty. I'm testing this case, but I've checked simple_sm.p - it works and doesn't contain the cases when prepLabel can be empty.

#7 Updated by Greg Shah over 8 years ago

Constantin reported that it was working too, but he found that his version was modified from the one in testcases/uast/menu/. On my system, with 1811q (or the p2J trunk), the testcases/uast/menu/simple_sm.p will fail.

#8 Updated by Greg Shah over 8 years ago

Have you been able to recreate this issue?

#9 Updated by Vadim Gindin over 8 years ago

Greg Shah wrote:

Have you been able to recreate this issue?

Well, yes I've added menu-items with empty label and label="&" (that ampersand will be removed during preprocessing) and got described NPE. I've fixed it and a small drawing bug (CHUI): when menu-item has focus: mnemonic character is displayed without UNDERLINE, but if mi.hasFocus()==false, than UNDERLINE is used.

I did it in my branch 2707a. I've checked out 1811q just now and I'm going to move my changes there, test it and commit. OK?

#10 Updated by Greg Shah over 8 years ago

I'm going to move my changes there, test it and commit.

Yes, please do.

#11 Updated by Vadim Gindin over 8 years ago

fix NPE, fix small drawing menu bug for CHUI: mnemonic for the focused menu-item is displayed without underline, fix NPE in menu GUI impls. Committed in revision 11037 of the branch 1811q.

By the way I've found, that menu GUI drawing is broken. Branch 1811q - run simple_sm.p open the second sub-menu and move mouse pointer to it's body and than out of it: you will see, that menu background around the body is drawn as menubar background. There is also some blinking, when moving mouse in the sub-menu body between different menu-items.

#12 Updated by Greg Shah over 8 years ago

  • Status changed from New to Closed

#13 Updated by Greg Shah over 8 years ago

  • % Done changed from 0 to 100
  • Assignee set to Vadim Gindin

#14 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 12 to GUI Support for a Complex ADM2 App

Also available in: Atom PDF