paint method and outlets

    Jul 27 2011 | 7:17 pm
    Hello everybody,
    I'd like to send a bang through an outlet when the painting method is done painting. (of course not at *every* paint method, just sometimes - I handle this with a flag.)
    I'm experiencing some troubles. Juce has a bad crash if I send just an outlet_bang in the paint method. Which could probably make sense to me; but I'm experiencing the very same crash also if I use: schedule_delay, qelem_set, defer_low. And I really don't understand why.
    Shortly: I've run out of ideas! I'm sure I'm doing something wrong. What should I do in order to have a bang sent when a certain paint method has been completed?
    Thanks a lot, Daniele

    • Jul 27 2011 | 10:54 pm
      Oops, as usual I didn't look carefully enough.
      The mistake was elsewhere - precisely here: apparently setting weird values for patching_rect makes Max crash:
      Yet, I'm still wandering: am I allowed to use outlets within the paint method, without scheduling or deferring?
      Thanks, Daniele
    • Jul 28 2011 | 9:48 pm
      Hi Daniele,
      I do not recommend making outlet calls in your paint method.
      At the moment you will probably find that it works to make such outlet calls, however, this will have the effect of executing parts of the patcher at inappropriate times (i.e. serviced from the main thread, but from the wrong queue) and could cause unexpected behaviors intermittently (which will be *very* hard to track down) and degrade the performance of the Max environment.
      I also don't recommend using schedule_delay(). If you need a high-priority event (which is unlikely if it is a paint notification) then use clock_new() and clock_delay(). For a low-priority event, the qelem is preferable to defer_low().
      Cheers, Tim
    • Jul 29 2011 | 7:43 pm
      Thanks Tim, everything is clear. I'll go with qelem, then.