[thelist] Object can't be accessed without an active lock??

Kevin krr at ix.netcom.com
Sat Sep 1 17:24:35 CDT 2001


I seem to have trouble with the <cflock> not being seen.
The exact error is:

Error Diagnostic Information
An error occurred while evaluating the expression:

SESSION.MovWiz = StructNew()
Error near line 45, column 13.
-----------------

Symbol SESSION.MovWiz is in a scope that contains data shared across threads
and cannot be accessed without an active lock

The error occurred while processing an element with a general identifier of
(CFSET), occupying document position (45:7) to (45:42).


I have the session set for full read in the admin panel and the checkbox is
unchecked for single threaded...

I didn't have a problem until I changed my session variables from being
spread through out the template to reading them into normal variables and
defining them into just the one <cflock> at the top of the template. I went
thru the entire template and can't seem to find anything that is out of
place.

The template is a series of 5 <cfcase's> used to create a template wizard.

any insight appreciated

Thank you
Kevin


<!---  Total number of steps in the wizard --->

<cfset NumOfSteps = 5>


<!---  The SESSION.MovWiz struct() holds the user's entries
       as they move thru the wizard.

              First Make Sure It Exists!
--->
<cflock timeout="30"
        throwontimeout="No"
        type="READONLY"
        scope="SESSION">

  <cfif NOT IsDefined("SESSION.MovWiz")>

    <!---  If structure undefined, create / initialize it  --->
      <cfset SESSION.MovWiz = StructNew()>
    <!---  Represents current wizard step; start at one  --->
      <cfset SESSION.MovWiz.StepNum = S_MovWiz.StepNum>
    <!---
         Initialize session variables and read them into normal variables
         This will reduce the effort needed to maintain the <cflock> state
         through out the template.
    --->
    <cfset SESSION.MovWiz.MovieTitle = S_MovWiz.MovieTitle>
    <cfset SESSION.MovWiz.PitchText = S_MovWiz.PitchText>
    <cfset SESSION.MovWiz.RatingID = S_MovWiz.RatingID>
    <cfset SESSION.MovWiz.DirectorID = S_MovWiz.DirectorID>
    <cfset SESSION.MovWiz.ActorIDs = S_MovWiz.ActorIDs>
    <cfset SESSION.MovWiz.StarActorID = S_MovWiz.StarActorID>

    <cfparam name="S_MovWiz.StepNum" default="1">
    <cfparam name="S_MovWiz.MovieText" default=" ">
    <cfparam name="S_MovWiz.PitchText" default=" ">
    <cfparam name="S_MovWiz.RatingID" default=" ">
    <cfparam name="S_MovWiz.DirectorID" default=" ">
    <cfparam name="S_MovWiz.ActorIDs" default=" ">
    <cfparam name="S_MovWiz.StarActorID" default=" ">


  </cfif>
</cflock>


<!---  If user just submitted MovieTitle, remember it
       Do same for the directorID, Actors and so on.
--->

  <cfif IsDefined("Form.MovieTitle")>
    <cfset S_MovWiz.MovieTitle = Form.MovieTitle>
    <cfset S_MovWiz.PitchText = Form.PitchText>
    <cfset S_MovWiz.RatingID = Form.RatingID>

  <cfelseif IsDefined("Form.DirectorID")>
   <cfset S_MovWiz.DirectorID = Form.DirectorID>

  <cfelseif IsDefined("Form.ActorID")>
    <cfset S_MovWiz.ActorIDs = Form.ActorID>

  <cfelseif IsDefined("Form.StarActorID")>
    <cfset S_MovWiz.StarActorID = Form.StarActorID>

  </cfif>

<!---  If user clicked back button, go back a step  --->
  <cfif IsDefined("Form.GoBack")>
    <cfset S_MovWiz.StepNum = URL.StepNum - 1>
<!---  If user clicked next button go forward one  --->
  <cfelseif IsDefined("Form.GoNext")>
    <cfset S_MovWiz.StepNum = URL.StepNum + 1>
<!---  If user clicked "finished" button, were done  --->
  <cfelseif IsDefined("Form.GoDone")>
    <cflocation URL="NewMovieCommit.cfm">
  </cfif>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
     <title>New Movie Form Wizard</title>
</head>

<body>

<!---  Show title and current step  --->
<cfoutput>
  <b>New Movie Wizard</b><br>
  Step #S_MovWiz.StepNum# of #NumOfSteps#<br>
</cfoutput>

<!---  Data entry form which submits back to itself  --->
<cfform action="NewMovieWizard.cfm?StepNum=#S_MovWiz.StepNum#" method="POST"
enablecab="Yes">

  <!---  Display the appropriate wizard step  --->
  <cfswitch expression="#S_MovWiz.StepNum#">

    <!---  step one: movie title  --->
    <cfcase value="1">
        <!---  Show text entry field for title  --->
        What is the title of the movie?<br>
        <cfinput type="Text"
         name="MovieTitle"
         value="#S_MovWiz.MovieTitle#"
         message="Please enter your movie title"
         size="50"
         maxlength="255">

      <!---  Show text entry for short description  --->
      <p>What is the "pitch" or "one-liner" for the movie?</p>
        <cfinput type="Text"
         name="PitchText"
         value="#S_MovWiz.PitchText#"
         message="Please enter the pitch text"
         size="50"
         maxlength="100">

       <CFQUERY NAME="GetRating" DATASOURCE="#DataSource#">
          SELECT    RatingID, Rating
          FROM      FilmsRatings
          ORDER BY  RatingID
       </CFQUERY>

     <p>Select your movie rating?</p>
       <cfselect name="RatingID"
          size="1"
          message="Please choose one"
          query="GetRating"
          display="Rating"
          value="RatingID"
          selected="#S_MovWiz.RatingID#">
        </cfselect><br>
    </cfcase>

    <cfcase value="2">
      <!---  Get list of directors from database  --->
      <CFQUERY NAME="GetDirectors" DATASOURCE="#DataSource#">
        SELECT
          DirectorID,
          FirstName+ ' ' +LastName AS FullName
        FROM
          Directors
        ORDER BY
          LastName
      </CFQUERY>

      <!---
              Show all directors in select list
              Pre select if user has chosen one
      --->

      Who will be directing the movie?<br>
        <cfselect name="Directors"
            size="#GetDirectors.RecordCount#"
            message="Please choose one of these directors"
            query="GetDirectors"
            value="DirectorID"
            display="FullName"
            selected="#S_MovWiz.DirectorID#"
            >
         </cfselect>
    </cfcase>

    <cfcase value="3">
      <!---  Get list of actors from database  --->
      <CFQUERY NAME="GetActors" DATASOURCE="#DataSource#">
        SELECT  *
        FROM    Actors
        ORDER BY  NameLast
      </CFQUERY>

     What actors will be in the movie?<br>

     <!---  For each actor, display check box  --->

     <cfloop query="GetActors">

      <!---  Should check box be pre-checked  --->
      <cfset IsChecked = ListFind(S_MovWiz.ActorIDs, ActorID)>

      <!---  Check box itself  --->
      <cfinput type="Checkbox"
       name="ActorID"
       value="#ActorID#">

      <!---  actor name  --->
      <cfoutput>#NameFirst# #NameLast#</cfoutput><br>
     </cfloop>
    </cfcase>

    <!---  Step for in the wizard -- who is the star?  --->
    <cfcase value="4">

      <cfif S_MovWiz.ActorIDs EQ " ">
        Please go back to the last step and choose at least one
        actor or actress to in the movie.

      <cfelse>
        <!---  Get actors who are in the film  --->
  <CFQUERY NAME="GetActors" DATASOURCE="#DataSource#">
          SELECT * FROM Actors
          WHERE ActorID IN (#S_MovWiz.ActorIDs#)
          ORDER BY NameLast
        </CFQUERY>

       Which one of the actors will get top billing?<br>

       <!---  For each actor, display radio button  --->
       <cfloop query="GetActors">

          <!---  should radio be pre checked  --->
          <cfset IsChecked = S_MovWiz.StarActorID EQ ActorID>

          <!---  Radio button itself  --->
          <cfinput type="Radio"
             name="StarActorID"
             value="#ActorID#"
             Checked = "#IsChecked#">

         <!---  actor name  --->
         <cfoutput>#NameFirst# #NameLast#</cfoutput><br>

       </cfloop>

      </cfif>


    </cfcase>
  </cfswitch>

  <p>
  <!---  show back button unless at first step  --->
  <cfif S_MovWiz.StepNum GT 1>
    <input type="submit" name="GoBack" value="<<< Back">
  </cfif>

  <!---
        Show next button unless at last step. If at last step
        show finish button.
  --->

  <cfif S_MovWiz.StepNum LT NumOfSteps>
    <input type="submit" name="GoNext" value="Next >>>">

  <cfelse>
    <input type="submit" name="GoDone" value="Finish">
  </cfif>
  </p>
</cfform>



</body>
</html>







More information about the thelist mailing list