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

Re: [MiNT] Window with toolbar and redraw messages



On 02/12/2013 10:49, J. F. Lemaire wrote:
When I did that (ub_parm pointing to a (largish) structure) the app
crashed. Once I had declared the structure outside the redrawing
function, and ub_parm simply pointed to the workstation handle, it no
longer crashed;

Remember that in C, the local variables are destroyed as soon as the function exits. So if you store a pointer in a USERDEF, it can't point to some local variable. It must point to some global variable, or better, a malloc'ed buffer. In other word, some memory which will still be valid at the time of the draw.

--
Vincent Rivière