[Fxruby-commits] CVS: FXRuby/swig-interfaces FXTreeList.i,1.29,1.30
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <ly...@us...> - 2002-03-23 00:03:27
|
Update of /cvsroot/fxruby/FXRuby/swig-interfaces In directory usw-pr-cvs1:/tmp/cvs-serv27719/swig-interfaces Modified Files: FXTreeList.i Log Message: Corrected the dangling pointer cleanup problem for FXTreeList#clearItems as described by Gilles in SF Bug #533804. Index: FXTreeList.i =================================================================== RCS file: /cvsroot/fxruby/FXRuby/swig-interfaces/FXTreeList.i,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** FXTreeList.i 19 Mar 2002 23:18:40 -0000 1.29 --- FXTreeList.i 23 Mar 2002 00:03:24 -0000 1.30 *************** *** 336,343 **** } } } - - /// Remove all items from list - void clearItems(FXbool notify=FALSE); /// Return item width --- 336,355 ---- } } + + /// Remove all items from list + void clearItems(FXbool notify=FALSE){ + // Save pointer(s) to the soon-to-be-destroyed items + FXObjectListOf<FXTreeItem> items; + FXRbTreeList::enumerateItems(self->getFirstItem(),self->getLastItem(),items); + + // Do the deed + self->clearItems(notify); + + // Now zero-out pointers held by still-alive Ruby objects + for(FXint i=0;i<items.no();i++){ + FXRbNotifyDestroyed(items[i]); + } + } } /// Return item width |