Skip to content
Snippets Groups Projects
Commit eed1edad authored by Lars Kanis's avatar Lars Kanis
Browse files

Fix GC bug in FXAccelTable

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.
parent cc801d1d
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment