Bug 938 - MemoryObject.java has no more equals() method
Summary: MemoryObject.java has no more equals() method
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: opengl (show other bugs)
Version: 2
Hardware: All all
: P1 critical
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2014-01-09 17:07 CET by Franco
Modified: 2014-01-14 05:39 CET (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
6c971f91fbe6a7e3bc45563d80d42a753586d629
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.