Hello, FPC developers' list.
We are preparing a next lazarus version and our users are heavily testing thing. One bug report let me found one error which is not a lazarus error, but fpc. This error happen because we used TObjectList to store bitmaps in a list.
TObjectList is a useful thing - we dont need to think about object destroying. They will be destroyed on deleting from the list. And everyting works except next call: AList[AIndex] := NewObject
I attached a test projects which shows a bug.
But in few words this bug happen due to double object destroying:
1. In TObjectList.SetItem (this is *not correct* place to destroy)
2. In TObjectList.Notify (this is *correct* place to destroy)
A solution is simple: remove everything from TObjectList.SetItem except Put call.
