#1102 [ruby] Segfault with "using" declaration with templates

open
ruby (61)
5
2010-10-01
2010-07-24
Jason Turner
No

If a template is instantiated which has a -> operator overload, and the class wrapped by the template contains a "using" declaration for members inherited from a base class, SWIG segfaults. The problem appears to affect only ruby (seems to be in documentation generation code?) generation. Attached is the smallest example I could come up with. The bug is in 1.3.40 and 2.0.0.

Discussion

  • Jason Turner
    Jason Turner
    2010-07-24

    sample illustrating crash

     
    Attachments
  • Olly Betts
    Olly Betts
    2010-10-01

    • summary: Segfault with "using" declaration with ruby and templates --> [ruby] Segfault with "using" declaration with templates
    • assigned_to: gga73 --> wsfulton
     
  • Olly Betts
    Olly Betts
    2010-10-01

    The issue is that the node for the method lacks a parent reference, so this code can't now get the classname in this case.

    I've committed a change to trunk r12237 which avoids the segfault by leaving out the classname if the parent reference isn't present.

    The generated string only seems to be used in an exception message, so it's largely cosmetic, but I suspect my "fix" is really just working around the issue - either the parent reference should be getting set on the method node, or the code should be finding the class name in a different way.

    But I'm not familiar enough with how this should work to know what's wrong here - assigning to William for comments (if my change is suitable, please just close the ticket).