diff --git a/ext/fox16/markfuncs.cpp b/ext/fox16/markfuncs.cpp index bea3a48784b38086fd867abc76282fcb22a9790e..464191b3e93e727447763c179158a3e59e134cef 100644 --- a/ext/fox16/markfuncs.cpp +++ b/ext/fox16/markfuncs.cpp @@ -42,6 +42,7 @@ static void delete_if_not_owned_by_app(BASECLASS* self,SUBCLASS*){ // FIXME: How to get to the target objects stored in the accelerator // table? This is currently private (not protected) data for the class. +// See workaround in lib/fox16/accel_table.rb. void FXRbAccelTable::markfunc(FXAccelTable* accelTable){ FXRbObject::markfunc(accelTable); } diff --git a/lib/fox16/accel_table.rb b/lib/fox16/accel_table.rb index 410d4e21624fec651e77818a1ad2611b2d4b78eb..0641aa4f83383e7ea44c402dbe6da6b6a22b953e 100644 --- a/lib/fox16/accel_table.rb +++ b/lib/fox16/accel_table.rb @@ -64,7 +64,20 @@ module Fox end end end + # FIXME: The target objects stored in the accelerator table are currently + # private. Therefore FXRbAccelTable::markfunc() doesn't mark them as used. + # As a workaround the objects are additionally stored in @targets Hash. + @targets = {} unless instance_variable_defined?('@targets') + @targets[hotKey] = tgt addAccelOrig(hotKey, tgt, seldn, selup) end + + alias removeAccelOrig removeAccel # :nodoc: + + def removeAccel(hotKey) + @targets = {} unless instance_variable_defined?('@targets') + @targets.delete(hotKey) + removeAccelOrig(hotKey) + end end end \ No newline at end of file