Menu

#577 4.0beta - Initdialog is failing

v4.0beta
closed
nobody
5
2012-08-14
2009-02-17
Jim129
No

When I run my application on Windows Vista 64-bit, I get an error that says "Open Object Rexx Interface has stopped working". I'm attaching my application. Although it's all there, only a small part is needed to make it fail.

Run TEMPD.REX which will cause the problem. It seems to fail in the InitDialog method of DAMainScreen.REX.

Discussion

  • Jim129

    Jim129 - 2009-02-17
     
  • Mark Miesfeld

    Mark Miesfeld - 2009-02-17

    Prize for the first bug reported.

    I'll take a look at this today.

     
  • Mark Miesfeld

    Mark Miesfeld - 2009-02-17

    I get different odd results on different systems.

    The reason is, in the defineDialog() method of the .Main class, there is this statement:

    self~CreateMenu(5)

    But, there are about 25 menu items added. The argument to createMenu is the maximum number of menu items to be added and the amount of memory allocated is determined by that.

    At least in the sample you attached, the problem is memory corruption. Only enough memory is allocated for 5 menu items. As the rest of the items are allocated they step on memory in the interpreter, causing havoc.

    Doing either

    self~CreateMenu

    or

    self~CreateMenu(55)

    fixes the attached sample. The default for createMenu with no arg is to allocate memory for 100 items. Really you should only specify the count argument if for some reason your menu is going to have over 100 items in it. I'll add some text to the doc to clarify that.

    Jim, try fixing that createMenu() call and see if it clears things up in your real program. I suspect it will.

    Let me know.

    By the way, your example works fine under 3.2.0 for me. That is just luck.

     
  • Jim129

    Jim129 - 2009-02-17

    Correcting the CreateMenu statement fixed the problem. As a suggestion, could the AddMenuItem method check to see if the current limit has been reached and put out a diagnostic?

     
  • Mark Miesfeld

    Mark Miesfeld - 2009-02-17

    I took a look earlier today with the idea in mind of tracking the memory pointer.

    The same potential problem exists in the UserDailog where the dialog template is constructed in memory. It is doable, but would be easier when the methods are converted to the new APIs.

    At this point, I'm going to put off doing it until the next release. This potential problem has been here since day 1.

     

Anonymous
Anonymous

Add attachments
Cancel