I encountered one strange problem with the release build (it works everything ok in debug) of my program. It appears in v1.28 and in 1.30 version of bmax. I tried to replicate the problem in a simple example but didnt succed, so I will describe it as good as I can... maybe Mark or some other expert will get an idea, what could be the cause.
The problematic part of code look like...
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
essentialy I am assigning pointers to sublists of Layers, which themself are extended TList objects. Now I have a part of code which look like:
For Local i=0 To 500
listaddlast(someList,someObject)
Next
...and put betwen link counted parts, I get some really weird behavior. Here are examples:
example 1
---------------------------------------------------
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
local someList:TList=New Tlist
For Local i=0 To 500
listaddlast(someList,someObject)
Next
someList=null
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
-------------------------------------------------------
this is causing error !
example 2
---------------------------------------------------
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
local someList:TList=New Tlist
For Local i=0 To 50
listaddlast(someList,someObject)
Next
someList=null
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
-------------------------------------------------------
this is working OK
example 3
---------------------------------------------------
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
local someList:TList=New Tlist
For Local i=0 To 50
listaddlast(someList,someObject)
Next
someList=null
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
someList:TList=New Tlist
For Local i=0 To 50
listaddlast(someList,someObject)
Next
someList=null
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
-------------------------------------------------------
this is causing error
example 4
---------------------------------------------------
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
local someList:TList=New Tlist
For Local i=0 To 500
listaddlast(someList,someObject)
Next
someList=null
-------------------------------------------------------
this is working OK
Now I know this looks strange... I tried to replicate this behavior in simple code but everything worked ok. In my program there is a lot more going on before this problemtic part as i am building data structure (the branching from master object is quite complex, with various lists, arrays in other objects.
Good thing for me is that this problem is not critical, as I can remove problematic code from the release build. Still i would love if I wouldnt have to worry, if my debug code will also work in release build.
Jure
The problematic part of code look like...
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
essentialy I am assigning pointers to sublists of Layers, which themself are extended TList objects. Now I have a part of code which look like:
For Local i=0 To 500
listaddlast(someList,someObject)
Next
...and put betwen link counted parts, I get some really weird behavior. Here are examples:
example 1
---------------------------------------------------
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
local someList:TList=New Tlist
For Local i=0 To 500
listaddlast(someList,someObject)
Next
someList=null
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
-------------------------------------------------------
this is causing error !
example 2
---------------------------------------------------
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
local someList:TList=New Tlist
For Local i=0 To 50
listaddlast(someList,someObject)
Next
someList=null
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
-------------------------------------------------------
this is working OK
example 3
---------------------------------------------------
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
local someList:TList=New Tlist
For Local i=0 To 50
listaddlast(someList,someObject)
Next
someList=null
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
someList:TList=New Tlist
For Local i=0 To 50
listaddlast(someList,someObject)
Next
someList=null
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
-------------------------------------------------------
this is causing error
example 4
---------------------------------------------------
link=Master.Layers.firstlink()
layer =TGfxLayer(link.Value())
p1=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p2=layer.sublist
link=link.nextlink()
layer =TGfxLayer(link.Value())
p3=layer.sublist
local someList:TList=New Tlist
For Local i=0 To 500
listaddlast(someList,someObject)
Next
someList=null
-------------------------------------------------------
this is working OK
Now I know this looks strange... I tried to replicate this behavior in simple code but everything worked ok. In my program there is a lot more going on before this problemtic part as i am building data structure (the branching from master object is quite complex, with various lists, arrays in other objects.
Good thing for me is that this problem is not critical, as I can remove problematic code from the release build. Still i would love if I wouldnt have to worry, if my debug code will also work in release build.
Jure