Re: Passing structure with a callback



On Sun, Jul 22, 2012 at 11:22:07PM -0600, Frank Cox wrote:
My widgetshare structure gets passed from main() to MainMenu with no
apparent problem, but using the same scheme to pass emailshare from
MainMenu to Clear segfaults.

This is elementary C.  Both structures are created on stack so they
cease to exist upon return from the corresponding functions.  While
main() is never exited while the program is running, MainMenu() is
particularly short-lived.

Use heap-allocated data.

Yeti




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]