Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-09

TObjectList crash!

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Paul Ishenin

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.

Best regards, Paul Ishenin.

Reply by email

Michael Van Canneyt
to Paul Ishenin
Paul Ishenin wrote 18 lines
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.

Confirmed, patched as suggested and tested. Revision 11732. Merged to fixes in rev. 11733.

Michael.

Reply by email