Menu

#97 Crash on bad func ptr typedef

OnBoard_C
open
nobody
OnBoard C (33)
5
2008-05-28
2008-05-27
No

Reported by Gareth on the Yahoo list.

...
Basically the line:

typedef Boolean (FormGadgetHandlerType) (struct FormGadgetType
*gadgetP, UInt16 cmd, void *paramP);

was causing the crash.

I changed it to

typedef Boolean (FormGadgetHandlerType*) (struct FormGadgetType
*gadgetP, UInt16 cmd, void *paramP);

and it compiled fine. It was definitely compile time not runtime.
...

My take on this is that this should be a callback declaration but instead of being a function pointer, it's a regular function and this is probably causing havoc. This really shouldn't crash if we can help it.

Discussion

  • Steve Little

    Steve Little - 2008-05-28

    Logged In: YES
    user_id=583634
    Originator: NO

    As far as I'm aware, the original version:
    typedef Boolean (FormGadgetHandlerType) (struct FormGadgetType
    *gadgetP, UInt16 cmd, void *paramP);

    is not legal C. As such, we should return a parser error & bail out.

    Definitely shouldn't cause a crash though!

    Hopefully not too tough to fix, either way...

     
  • Steve Little

    Steve Little - 2008-05-28
    • summary: Crash on this code. --> Crash on bad func ptr typedef
     

Log in to post a comment.