mod/maxgui.mod/fltkmaxgui.mod/src/Fl.cxx
void Fl::watch_widget_pointer(Fl_Widget *&w) 
{
  Fl_Widget **wp = &w;
  int i;
  for (i=0; i<num_widget_watch; ++i) {
    if (widget_watch[i]==wp) return;
  }
  if (num_widget_watch==max_widget_watch) {
    max_widget_watch += 8;
    widget_watch = (Fl_Widget***)realloc(widget_watch, sizeof(Fl_Widget**)*max_widget_watch);
  }
  widget_watch[num_widget_watch++] = wp;
#ifdef DEBUG_WATCH
  printf ("\nwatch_widget_pointer:   (%d/%d) %8p => %8p\n",
    num_widget_watch,num_widget_watch,wp,*wp);
  fflush(stdout);
#endif // DEBUG_WATCH
}
/**
  Adds a widget pointer to the widget watch list.
  
  \note Internal use only, please use class Fl_Widget_Tracker instead.

  This can be used, if it is possible that a widget might be deleted during
  a callback or similar function. The widget pointer must be added to the
  watch list before calling the callback. After the callback the widget
  pointer can be queried, if it is NULL. \e If it is NULL, then the widget has been
  deleted during the callback and must not be accessed anymore. If the widget
  pointer is \e not NULL, then the widget has not been deleted and can be accessed
  safely.

  After accessing the widget, the widget pointer must be released from the
  watch list by calling Fl::release_widget_pointer().

  Example for a button that is clicked (from its handle() method):
  \code
    Fl_Widget *wp = this;		// save 'this' in a pointer variable
    Fl::watch_widget_pointer(wp);	// add the pointer to the watch list
    set_changed();			// set the changed flag
    do_callback();			// call the callback
    if (!wp) {				// the widget has been deleted

      // DO NOT ACCESS THE DELETED WIDGET !

    } else {				// the widget still exists
      clear_changed();			// reset the changed flag
    }

    Fl::release_widget_pointer(wp);	// remove the pointer from the watch list
   \endcode

   This works, because all widgets call Fl::clear_widget_pointer() in their
   destructors.

   \see Fl::release_widget_pointer()
   \see Fl::clear_widget_pointer()

   An easier and more convenient method to control widget deletion during
   callbacks is to use the class Fl_Widget_Tracker with a local (automatic)
   variable.

   \see class Fl_Widget_Tracker
*/
Adds a widget pointer to the widget watch list.
\note Internal use only, please use class Fl_Widget_Tracker instead.

This can be used, if it is possible that a widget might be deleted during
a callback or similar function. The widget pointer must be added to the
watch list before calling the callback. After the callback the widget
pointer can be queried, if it is NULL. \e If it is NULL, then the widget has been
deleted during the callback and must not be accessed anymore. If the widget
pointer is \e not NULL, then the widget has not been deleted and can be accessed
safely.

After accessing the widget, the widget pointer must be released from the
watch list by calling Fl::release_widget_pointer().



DO NOT ACCESS THE DELETED WIDGET !

} else {                            // the widget still exists
clear_changed();                  // reset the changed flag
}

:release_widget_pointer(wp);     // remove the pointer from the watch list
\endcode

This works, because all widgets call Fl::clear_widget_pointer() in their
destructors.



An easier and more convenient method to control widget deletion during
callbacks is to use the class Fl_Widget_Tracker with a local (automatic)
variable.


Adds a widget pointer to the widget watch list . \ note Internal use only please use class Fl_Widget_Tracker instead . This can be used if it is possible that a widget might be deleted during a callback or similar function . The widget pointer must be added to the watch list before calling the callback . After the callback the widget pointer can be queried if it is NULL . \ e If it is NULL then the widget has been deleted during the callback and must not be accessed anymore . If the widget pointer is \ e not NULL then the widget has not been deleted and can be accessed safely . After accessing the widget the widget pointer must be released from the watch list by calling Fl :: release_widget_pointer () . DO NOT ACCESS THE DELETED WIDGET ! } else { // the widget still exists clear_changed () ; // reset the changed flag } : release_widget_pointer ( wp ) ; // remove the pointer from the watch list \ endcode This works because all widgets call Fl :: clear_widget_pointer () in their destructors . An easier and more convenient method to control widget deletion during callbacks is to use the class Fl_Widget_Tracker with a local ( automatic ) variable .
void Fl::watch_widget_pointer(Fl_Widget *&w) 
{
  Fl_Widget **wp = &w;
  int i;
  for (i=0; i<num_widget_watch; ++i) {
    if (widget_watch[i]==wp) return;
  }
  if (num_widget_watch==max_widget_watch) {
    max_widget_watch += 8;
    widget_watch = (Fl_Widget***)realloc(widget_watch, sizeof(Fl_Widget**)*max_widget_watch);
  }
  widget_watch[num_widget_watch++] = wp;
#ifdef DEBUG_WATCH
  printf ("\nwatch_widget_pointer:   (%d/%d) %8p => %8p\n",
    num_widget_watch,num_widget_watch,wp,*wp);
  fflush(stdout);
#endif 
}
void Fl :: watch_widget_pointer ( Fl_Widget * & w ) { Fl_Widget * * wp = & w ; int i ; for ( i = 0 ; i < num_widget_watch ; ++ i ) { if ( widget_watch [ i ] == wp ) return ; } if ( num_widget_watch == max_widget_watch ) { max_widget_watch += 8 ; widget_watch = ( Fl_Widget * * * ) realloc ( widget_watch , sizeof ( Fl_Widget * * ) * max_widget_watch ) ; } widget_watch [ num_widget_watch ++ ] = wp ; #ifdef DEBUG_WATCH printf ( " \n \n " , num_widget_watch , num_widget_watch , wp , * wp ) ; fflush ( stdout ) ; #endif }
Adds a widget pointer to the widget watch list.
Adds a widget pointer to the widget watch list .
// DEBUG_WATCH