jerry hedden drbcqzxlcpanorg im trying come fix bug related storing shared objects inside shared structures bug proxy objects shared object destroyed objects destroy routine called even thought object yet destroyed problem code provided seg faults cant figure help comments suggestions etc would appreciated following elicits bug usrbinperl use strict use warnings use threads use threadsshared package jar jar shared sub new blessthreadssharedshare shift sub store self cookie _ pushjar cookie printjar cookie storedn return jar1 bug cookie destroyed package cookie destruction_count 0 sub new blessthreadssharedshare shift sub destroy destruction_count printcookie destruction count destruction_countn package main main jar jarnew cookie cookienew printmain storing cookien jarstorecookie printnmain cookie destroyed yetn printnmain exiting scopen printndonen outputs main storing cookie jar cookie stored cookie destruction count 1 main cookie destroyed yet main exiting scope cookie destruction count 2 done shows destroy called twice first time destruction proxy object attempting fix bug first providing call threadsshared extthreadssharedsharedxs report whether shared object destroyed ref shared refcnt greater one destroyed void _is_destroyablesv shared_var prototype preinit sv ssv code shared_var svrvshared_var svrokshared_var shared_var svrvshared_var ssv perl_sharedsv_findathx_ shared_var st0 ssv svrefcntssv 1 pl_sv_no pl_sv_yes xsreturn1 implied use call inside perl_sv_clear svc control execution destructors shared objects code ifdef use_ithreads block follows example returning scalar perlcall used do_mark_cloneable_stash svc idea shared objects destroy routine called unless last proxy object destroyed ie refcnt private sv 1 void perl_sv_clearpthx_ register sv sv dvar const u32 type svtypesv const struct body_details const sv_type_details bodies_by_type type hv stash assertsv assertsvrefcntsv 0 type svt_iv see comment svh collusion early return overloading null iv slots size table return svobjectsv pl_defstash still symbol table ifdef use_ithreads iv destroyable cv check_destroyable get_cvthreadsshared_is_destroyable 0 check_destroyable dsp int count enter savetmps pushmarksp xpushssv putback count call_svsvcheck_destroyable g_scalar spagain count 1 perl_croakathx_ threadsshared_is_destroyable failed return result destroyable popi putback freetmps leave else destroyable 1 destroyable endif hv stash dsp cv destructor stash svstashsv destructor stashhandlerstashdestroy destructor sv const tmpref newrvsv svreadonly_ontmpref destroy could naughty enter pushstackiperlsi_destroy extendsp 2 pushmarksp pushstmpref putback call_svsvdestructor g_discardg_evalg_keeperrg_void popstack spagain leave ifsvrefcnttmpref 2 tmpref kept alive svrefcntsv svrv_settmpref null svrok_offtmpref svrefcnt_dectmpref svobjectsv svstashsv stash svrefcntsv pl_in_clean_objs perl_croakathx_ destroy created new reference dead object hvname_getstash destroy gave object new lease life return ifdef use_ithreads endif svobjectsv svrefcnt_decsvstashsv possibly changed persuasion svobject_offsv curse object type svt_pvio pl_sv_objcount xxx might want something general patch blead attached thu 07 aug 2008 064022 0400 need help bug fix storing shared objects shared structures