Update of /cvsroot/fxruby/FXRuby/ext/fox
In directory usw-pr-cvs1:/tmp/cvs-serv9977
Modified Files:
FXRuby.cpp
Log Message:
Ripped out stuff about borrowed references and FXRbNotifyDestroyed().
This can all be handled with the current FXRbRegisterRubyObj() and
FXRbUnregisterRubyObj() functionality.
Index: FXRuby.cpp
===================================================================
RCS file: /cvsroot/fxruby/FXRuby/ext/fox/FXRuby.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** FXRuby.cpp 1 Apr 2002 14:55:55 -0000 1.37
--- FXRuby.cpp 1 Apr 2002 23:17:48 -0000 1.38
***************
*** 77,88 ****
}
- // Maps void pointers to linked lists of VALUEs
- static std::map<void*, std::list<VALUE> > borrowedRefs;
-
// Wrapper around SWIG_NewPointerObj()
VALUE FXRbNewPointerObj(void *ptr,swig_type_info* ty){
! VALUE obj=SWIG_NewPointerObj(ptr,ty,0);
! borrowedRefs[ptr].push_back(obj);
return obj;
}
--- 77,85 ----
}
// Wrapper around SWIG_NewPointerObj()
VALUE FXRbNewPointerObj(void *ptr,swig_type_info* ty){
! VALUE obj=SWIG_NewPointerObj(ptr,ty,1);
! FXRbRegisterRubyObj(obj,ptr);
return obj;
}
***************
*** 150,172 ****
/**
* Return the registered Ruby class instance associated with this
! * FOX object, or a new unregistered instance if not found.
*/
VALUE FXRbGetRubyObj(const void *foxObj, const char *type){
VALUE rbObj = FXRbGetRubyObj(foxObj);
return (rbObj == Qnil) ? FXRbNewPointerObj(const_cast<void*>(foxObj), FXRbTypeQuery(type)) : rbObj;
- }
-
-
- // Zero-out any pointers to this object still held by Ruby objects
- void FXRbNotifyDestroyed(void* ptr){
- std::map<void*, std::list<VALUE> >::iterator itr=borrowedRefs.find(ptr);
- if(itr!=borrowedRefs.end()){
- std::list<VALUE>::iterator i;
- for(i=(itr->second).begin(); i!=(itr->second).end(); i++){
- VALUE obj=*i;
- DATA_PTR(obj)=0;
- }
- borrowedRefs.erase(itr);
- }
}
--- 147,155 ----
/**
* Return the registered Ruby class instance associated with this
! * FOX object, or a new registered instance if not found.
*/
VALUE FXRbGetRubyObj(const void *foxObj, const char *type){
VALUE rbObj = FXRbGetRubyObj(foxObj);
return (rbObj == Qnil) ? FXRbNewPointerObj(const_cast<void*>(foxObj), FXRbTypeQuery(type)) : rbObj;
}
|