Bug 938

Summary: MemoryObject.java has no more equals() method
Product: [JogAmp] Jogl Reporter: Franco <fzanelli>
Component: openglAssignee: Sven Gothel <sgothel>
Severity: critical    
Priority: P1    
Version: 2   
Hardware: All   
OS: all   
Type: DEFECT SCM Refs:
Workaround: ---

Description Franco 2014-01-09 17:07:37 CET
Unlike version 2.0rc11, in version 2.1.3 the class MemoryObject hasn't equals() method. In this way getOrAddSafe() add always the object even if the object is already in the map, se we have memory leak.

In my opinion you need to reintroduce the following method:
public boolean equals(Object obj) {
        if(this == obj) { return true; }
        if(obj instanceof MemoryObject) {
            MemoryObject m = (MemoryObject) obj;
            return addr == m.addr && size == m.size ;
        return false;
Comment 1 Sven Gothel 2014-01-14 05:39:26 CET
Thank you for finding this regression!


    Bug 938 - MemoryObject.java has no more equals() method
    Re-adding 'equals(..)' method erroneously removed with commit 8457bf35fee253d9af29ff1150a9671f6896fc17.
    'equals(..)' is important to allow the HashMap<> for glMapBuffer(..) work properly!


Further GLBufferStateTracker / glMapBuffer work is underway,
please see Bug 942 and review/help.