Protected NOT protected?

TailBite specific forum

Moderators: gnozal, ABBKlaus, lexvictory

akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Protected NOT protected?

Post by akee »

Tailbite 1.4.7 with PB 4.51.
Tailbite First.pb and Second.pb. Then run Third.pb. Seems that the protected variable alpha$ gets shared.

First.pb

Code: Select all

Procedure$ First_Private(p1$)
  Protected alpha$ = ""
  alpha$ = p1$ + " first"
  ProcedureReturn alpha$
EndProcedure

ProcedureDLL$ First(p1$)
  ProcedureReturn First_Private(p1$)
EndProcedure
Second.pb

Code: Select all

Procedure$ Seconds_Private(p1$)
  Protected alpha$ = ""
  alpha$ = p1$ + " second"
  ProcedureReturn alpha$
EndProcedure

ProcedureDLL$ Seconds(p1$)
  ProcedureReturn Seconds_Private(p1$)
EndProcedure
Third.pb

Code: Select all

Debug First(Seconds("*"))   ; * second* second first

Procedure$ InFirst(p1$)
  Protected alpha$ = ""
  alpha$ = p1$ + " first"
  ProcedureReturn alpha$
EndProcedure

Procedure$ InSeconds(p1$)
  Protected alpha$ = ""
  alpha$ = p1$ + " second"
  ProcedureReturn alpha$
EndProcedure

Debug InFirst(InSeconds("*"))   ; * second first
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: Protected NOT protected?

Post by ABBKlaus »

Its a known issue (the first one on the list) and has nothing to do with the protected keyword.
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: Protected NOT protected?

Post by akee »

Tanks for the feedback ABBKlaus. Do you know if 4.60 fixes this? :)
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: Protected NOT protected?

Post by akee »

Just retried this example with 4.60 RC1. This bug is not yet fixed... :(
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: Protected NOT protected?

Post by gnozal »

akee wrote:Just retried this example with 4.60 RC1. This bug is not yet fixed... :(
It is not a PB bug, as PB libraries work fine.
It's a Tailbite issue (http://www.purebasic.fr/english/viewtopic.php?p=230189) related to the 'double PUSH dword [_PB_StringBasePosition]' in Purebasic.asm when a procedure returns a string.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply