hi all ...
i'm curious about the behaviour of canvas_getcurrent() ... i'm using it in k_cext and only get NULL ...
is there anything i have to pay attention on when using it?
cheers ... tim
Hi Tim,
always call it from the new() routine; otherwise the current canvas is undefined. You can store the pointer for later (an object's parent canvas is guaranteed never to change.)
cheers Miller
On Sun, Oct 31, 2004 at 11:13:21PM +0100, Tim Blechmann wrote:
hi all ...
i'm curious about the behaviour of canvas_getcurrent() ... i'm using it in k_cext and only get NULL ...
is there anything i have to pay attention on when using it?
cheers ... tim
-- mailto:TimBlechmann@gmx.de ICQ: 96771783 http://www.mokabar.tk
After one look at this planet any visitor from outer space would say "I want to see the manager." William S. Burroughs
PD-dev mailing list PD-dev@iem.at http://iem.at/cgi-bin/mailman/listinfo/pd-dev
always call it from the new() routine; otherwise the current canvas is undefined. You can store the pointer for later (an object's parent canvas is guaranteed never to change.)
hm ... if something like this would be documented some way, it might reduce my headaches when trying to explain this error ... i assume, this behaviour is the same for all canvas functions exported in m_pd.h? if so, a small comment in m_pd.h would definitely be useful ...
cheers ... tim
This is a big unresolved question for me... I don't have a policy about: (1) under what contextx you can safely call functions; and (2) if a function returns a pointer to something, how long can you expect the pointer to be valid afterward. I'd like to get it all coherent; then I wouldn't have to write hundereds of comments and people wouldn't have to read them all!
cheers Miller
On Thu, Nov 04, 2004 at 11:51:53AM +0100, Tim Blechmann wrote:
always call it from the new() routine; otherwise the current canvas is undefined. You can store the pointer for later (an object's parent canvas is guaranteed never to change.)
hm ... if something like this would be documented some way, it might reduce my headaches when trying to explain this error ... i assume, this behaviour is the same for all canvas functions exported in m_pd.h? if so, a small comment in m_pd.h would definitely be useful ...
cheers ... tim
-- mailto:TimBlechmann@gmx.de ICQ: 96771783 http://www.mokabar.tk
After one look at this planet any visitor from outer space would say "I want to see the manager." William S. Burroughs
On Fri, 5 Nov 2004 11:25:17 -0800 Miller Puckette mpuckett@man104-1.ucsd.edu wrote:
(2) if a function returns a pointer to something, how long can you expect the pointer to be valid afterward.
you could do something like with the pointers to a table ... keep the pointers you have set in memory and update them ... with something like that, it might even be possible to write a garbage collector ... anyway, no function would be allowed to change these pointers, except with a certain function ...
cheers ... tim
Hmm, this is already done, sort of, by the symbol binding mechanism. Perhaps I should go binding the current canvas to sa symbol and just return _that_. But I'm scared of the potential performance hit of having everything have to work that way.
M
On Fri, Nov 05, 2004 at 10:50:00PM +0100, Tim Blechmann wrote:
On Fri, 5 Nov 2004 11:25:17 -0800 Miller Puckette mpuckett@man104-1.ucsd.edu wrote:
(2) if a function returns a pointer to something, how long can you expect the pointer to be valid afterward.
you could do something like with the pointers to a table ... keep the pointers you have set in memory and update them ... with something like that, it might even be possible to write a garbage collector ... anyway, no function would be allowed to change these pointers, except with a certain function ...
cheers ... tim
-- mailto:TimBlechmann@gmx.de ICQ: 96771783 http://www.mokabar.tk
After one look at this planet any visitor from outer space would say "I want to see the manager." William S. Burroughs
PD-dev mailing list PD-dev@iem.at http://iem.at/cgi-bin/mailman/listinfo/pd-dev