mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* store globals as weakptr in class/funcs to prevent memleak when stored as global WIP * let it crash if globals are no longer valid? * typo * removed debug prints * let only the current executor crash * fixed logic * added and corrected tests * cleanup * use emplace_back * classes also need to switch to weakptr * docs
23 lines
634 B
Text
23 lines
634 B
Text
use os;
|
|
|
|
var dest_glob0 := "dg0";
|
|
var dest_glob1 := "dg1";
|
|
var dest_glob2 := "dg2";
|
|
|
|
program destroyed( test_pid )
|
|
var res := start_script( ":testfuncref:call-and-send", @DestroyedUserFunc );
|
|
GetProcess( test_pid ).SendEvent( struct{ type := "spawned", result := res } );
|
|
return 1;
|
|
endprogram
|
|
|
|
function DestroyedUserFunc( use_globals, args... )
|
|
var dest_loc1 := True;
|
|
var dest_loc2 := "hello local";
|
|
if ( use_globals )
|
|
dest_glob1 := $"{dest_glob0} {dest_glob1} {dest_glob2} DestroyedUserFunc({args})";
|
|
return dest_glob1;
|
|
else
|
|
return $"{dest_loc1} {dest_loc2} DestroyedUserFunc({args})";
|
|
endif
|
|
endfunction
|
|
|