#1121 ooDialog appcrash running forward class(super) continue

ooDialog.4.2.1
closed
complete
5
2013-01-12
2012-10-04
No

Running the following code generates an appcrash in ooDialog.dll.
If 'continue' is removed from the forward command, the problem disappears.

page1 = .Page1~new(,,,"Page1")
page2 = .Page2~new(,,,"Page2")
pages = .Array~of(page1,page2)
ps = .PropertySheetDialog~new(pages,,"Property Sheet")
say ps~execute
::class Page1 subclass UserPSPDialog INHERIT tree
::class Page2 subclass UserPSPDialog
::class tree mixinclass UserDialog
::method init
forward class(super) continue
::requires "oodialog.cls"

1
APPCRASH
No disponible
0
rexxpaws.exe
4.1.2.8305
503d7f0b
oodialog.DLL
4.2.0.8276
5039ba0a
c0000005
0002bd3c

Discussion

  • Mark Miesfeld

    Mark Miesfeld - 2012-10-04
    • labels: --> ooDialog
    • status: open --> accepted
    • assigned_to: Mark Miesfeld
    • pending_work_items: none --> code+test
    • milestone: None --> ooDialog.4.2.0
     
  • Mark Miesfeld

    Mark Miesfeld - 2012-10-04

    Hi Staffan,

    Your code brought out a bug in the error checking. The error was detected, but the code continued when it should have aborted on the error. So, it's good you uncovered it.

    However, what you are doing is not correct. If it wasn't for the bug you would have seen this when you ran your example:

    C:\work.ooRexx\bug.work\mixin.class.userDialog>mixinDlg.rex
    - Compiled method EXECUTE with scope "PropertySheetDialog"
    5 - say ps~execute
    Error 98 running C:\work.ooRexx\bug.work\mixin.class.userDialog\mixinDlg.rex line 5: Execution error
    Error 98.900: The dialog template for the Windows property sheet page (page 1) could not be created

    Which is a correct description of the error, however it doesn't highlight the underlying cause in your code. So, as part of the fix for this bug I've reworked things and you would now get this:

    C:\work.ooRexx\bug.work\mixin.class.userDialog>mixinDlg.rex
    - Compiled method INITTEMPLATE with scope "PropertySheetPage"
    - Compiled method EXECUTE with scope "PropertySheetDialog"
    5 - say ps~execute
    Error 98 running C:\work.ooRexx\bug.work\mixin.class.userDialog\mixinDlg.rex line 5: Execution error
    Error 98.900: The PropertySheetPage base class has not been initialized correctly

    I'm not sure what you are trying to do with your code, probably because it is stripped down, but this is the problem:

    ::class tree mixinclass UserDialog
    ::method init
    forward class(super) continue

    coming from this:

    ::class Page1 subclass UserPSPDialog INHERIT tree

    Your init() method above bypasses the proper initialization of the UserPSPDialog object. You could erroneously try this:

    ::class tree mixinclass UserDialog
    ::method init
    forward class(.UserPSPDialog) continue

    which won't work either. UserPSPDialog already inherits UserDialog, so the above will create a loop that ends with:

    13 *-* forward class(.UserPSPDialog) continue
       *-* Compiled method INIT with scope "UserPSPDialog"
       *-* Compiled method NEW with scope "Object"
       *-* Compiled method NEW with scope "PlainBaseDialog"
     1 *-* page1 = .Page1~new(,,,"Page1")
    

    Error 11 running C:\work.ooRexx\bug.work\mixin.class.userDialog\mixinDlg.rex line 1: Control stack full
    Error 11.1: Insufficient control stack space; cannot continue execution

    This change will work:

    ::class Page1 subclass tree

    ::class Page2 subclass UserPSPDialog

    ::class tree mixinclass UserPSPDialog
    ::method init
    forward class(super) continue

    although, for the simple example it would make more sense to do this:

    ::class Page1 subclass tree

    ::class Page2 subclass tree

    ::class tree mixinclass UserPSPDialog
    ::method init
    forward class(super) continue

    Not knowing what you are ultimately trying to do, I'm not sure if the above will serve your needs or not.

    Thanks for finding the bug.

     
  • Mark Miesfeld

    Mark Miesfeld - 2012-10-04

    Staffan,

    In looking back over what I posted, I would say that I wouldn't do this:

    ::class Page1 subclass tree

    ::class Page2 subclass tree

    ::class tree mixinclass UserPSPDialog

    ::method init
    forward class(super) continue

    tree shouldn't be a mixin class, it should be this:

    ::class Page1 subclass tree

    ::class Page2 subclass tree

    ::class tree subclass UserPSPDialog

    ::method init
    forward class(super) continue

     
  • Staffan Tylen

    Staffan Tylen - 2012-10-04

    Hi Mark,

    Thanks for the quick feedback. The sample code was just put together to
    ensure that the crash would happen. I stumbled over this while trying to
    put a class I developed into a property sheet tab. I felt quite sure that
    the example was not correctly coded but even so it shouldn't cause the
    dialog to crash. I'm still struggling to understand the pros and cons in
    using subclass versus mixinclass but I hope this will get more clear over
    time.

    Thanks,
    Staffan

     
  • Mark Miesfeld

    Mark Miesfeld - 2012-10-04

    Staffan, I understand that you put the example together to demonstrate the crash, and that's fine.

    Just be aware that if you saw this crash in the program you are working on, you are doing something in that program that bypasses the proper base class initialization also. When the bug is fixed, your program won't crash, but it won't work either.

     
  • Mark Miesfeld

    Mark Miesfeld - 2012-10-04

    Committed revision [r8480]

    • labels: ooDialog --> ooDialog, fixed
    • status: accepted --> pending
    • pending_work_items: code+test --> complete
    • milestone: ooDialog.4.2.0 --> ooDialog.4.2.1
     

    Related

    Commit: [r8480]

  • Mark Miesfeld

    Mark Miesfeld - 2012-10-04
     
  • Mark Miesfeld

    Mark Miesfeld - 2013-01-12

    Fixed in the ooDialog 4.2.1 release.

     
  • Mark Miesfeld

    Mark Miesfeld - 2013-01-12
    • status: pending --> closed
     


Anonymous

Cancel  Add attachments