Hi,

I'm back online (after 40 days of no email, no mobile phone, few civilization). Thanks for great job and 1.0! :)

My co-worker passed me a bug sample:

FUNC Main()
LOCAL aI
  aI := {}
  AADD(aI, HB_Hash("S", 10))
  AADD(aI, HB_HClone(aI[1]))
  aI[1,"S"] := 1
  aI[2,"S"] -= 1
  AADD(aI, HB_HClone(aI[2]))
  aI[2, "S"] := 2
  ? "Expected result: 1 2 9"
  ? "Result:", aI[1,"S"], aI[2,"S"], aI[3,"S"]

  // Changing -= to - fixes bug
  aI := {}
  AADD(aI, HB_Hash("S", 10))
  AADD(aI, HB_HClone(aI[1]))
  aI[1,"S"] := 1
  aI[2,"S"] := aI[2,"S"] - 1   // instead of -=
  AADD(aI, HB_HClone(aI[2]))
  aI[2, "S"] := 2
  ? "Result without -=:", aI[1,"S"], aI[2,"S"], aI[3,"S"]

  // Changing HB_HClone() to manual clone fixes bug
  aI := {}
  AADD(aI, HB_Hash("S", 10))
  AADD(aI, HB_Hash())
  HB_HEval(aI[1], {|K,V| aI[2,K]:=V}) // HB_HClone()
  aI[1,"S"] := 1
  aI[2,"S"] -= 1
  AADD(aI, HB_Hash())
  HB_HEval(aI[2], {|K,V| aI[3,K]:=V}) // HB_HClone()
  aI[2, "S"] := 2
  ? "Result without HB_HClone:", aI[1,"S"], aI[2,"S"], aI[3,"S"]
RETURN NIL


Best regards,
Mindaugas
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to