I've started experimenting a bit with using structs in application variables
and have noticed something odd, although it may be expected behavior...
Say I set up a struct called "test", and then stored it inside an
application variable called "application.test". Now I want to copy the
entire application scope into a local variable so I can manipulate it
without worrying about locking it all over the place:
<CFSET App = StructCopy(Application)>
Now, I should be able to now call all the "application.whatever" variables
with the syntax "app.whatever". This technique actually works just great
with simple values, but not with structs stored in the application scope.
When I try to access "app.test", I get the error: "Symbol App.test is in a
scope that contains data shared across threads and cannot be accessed
without an active lock" (I have Full checking turned on in the CFAdmin),
which means that the test struct was not actually copied. Instead, a pointer
to the original struct inside the application struct was created.
I can get around this problem by manually copying the struct like so (but
it's a pain in the rear):
<CFSET App.test = StructCopy(Application.test)>
So my question is... Shouldn't the StructCopy() function copy the entire
struct, and any other structs stored inside it? Has anyone else run into
this experience, or is it considered expected behavior when copying structs
which contain other structs?
Did that make sense?
-Cameron
--------------------
Cameron Childress
McRae Communications
p. 770-460-7277 x.232
f. 770-460-0963
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.