Commit f485259b authored by stolpmann's avatar stolpmann

Fix in Wd_interactor.unserialize.

The [interactors] are now locked in the "handle" stage of processing.
Any trial will fail.


git-svn-id: https://godirepo.camlcity.org/svn/wdialog/trunk@225 f54c9a64-0731-4a92-b797-30fd5898f27c
parent 480c253e
......@@ -21,7 +21,7 @@
* </>
*)
(* $Id: wd_cycle.ml,v 3.15 2005-06-11 14:24:14 stolpmann Exp $
(* $Id: wd_cycle.ml,v 3.16 2005-12-09 20:02:40 stolpmann Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -825,6 +825,9 @@ let process_request
t1 := Unix.gettimeofday();
dlg # lock_ia true;
(* Do not allow the creation of interactors during [handle] *)
if event <> No_event || force_handle_invocation then begin
try
dlg # handle();
......@@ -843,6 +846,9 @@ let process_request
(* Case (b) *)
dlg # set_next_page pg;
end;
dlg # lock_ia false;
(* Unlock again *)
); (* Terminate old session scope... *)
in_session_scope
......@@ -999,7 +1005,13 @@ let process_request
* History:
*
* $Log: wd_cycle.ml,v $
* Revision 3.15 2005-06-11 14:24:14 stolpmann
* Revision 3.16 2005-12-09 20:02:40 stolpmann
* Fix in Wd_interactor.unserialize.
*
* The [interactors] are now locked in the "handle" stage of processing.
* Any trial will fail.
*
* Revision 3.15 2005/06/11 14:24:14 stolpmann
* Extension of bracket expressions: many new functions.
* Functions in bracket expressions may now lazily evaluate their arguments.
* ui:if and ui:ifvar may refer to any functions defined for bracket
......
......@@ -21,7 +21,7 @@
* </>
*)
(* $Id: wd_dialog.ml,v 3.12 2005-06-11 14:24:14 stolpmann Exp $
(* $Id: wd_dialog.ml,v 3.13 2005-12-09 20:02:40 stolpmann Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -29,7 +29,7 @@
open Wd_types
open Wd_serialize
let revision_dialog = "$Revision: 3.12 $" ;;
let revision_dialog = "$Revision: 3.13 $" ;;
(* intentionally the CVS revision string *)
let serialize_interactor f b ia =
......@@ -266,6 +266,17 @@ class virtual dialog
self # init_defaults;
method lock_ia b =
Wd_interactor.lock interactors.ui_buttons b;
Wd_interactor.lock interactors.ui_imagebuttons b;
Wd_interactor.lock interactors.ui_anchors b;
Wd_interactor.lock interactors.ui_indexed_buttons b;
Wd_interactor.lock interactors.ui_indexed_imagebuttons b;
Wd_interactor.lock interactors.ui_indexed_anchors b;
Wd_interactor.lock interactors.ui_vars b;
Wd_interactor.lock interactors.ui_uploads b;
method page_names =
declaration # page_names
......@@ -979,7 +990,13 @@ end
* History:
*
* $Log: wd_dialog.ml,v $
* Revision 3.12 2005-06-11 14:24:14 stolpmann
* Revision 3.13 2005-12-09 20:02:40 stolpmann
* Fix in Wd_interactor.unserialize.
*
* The [interactors] are now locked in the "handle" stage of processing.
* Any trial will fail.
*
* Revision 3.12 2005/06/11 14:24:14 stolpmann
* Extension of bracket expressions: many new functions.
* Functions in bracket expressions may now lazily evaluate their arguments.
* ui:if and ui:ifvar may refer to any functions defined for bracket
......
......@@ -21,7 +21,7 @@
* </>
*)
(* $Id: wd_interactor.ml,v 3.5 2005-06-11 14:24:14 stolpmann Exp $
(* $Id: wd_interactor.ml,v 3.6 2005-12-09 20:02:40 stolpmann Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -39,6 +39,7 @@ type 'value_type t =
mutable n_entries : int;
mutable names : string array;
mutable n_names : int;
mutable locked : bool;
}
(* "entries": only the positions 0 to n_entries - 1 are used.
......@@ -58,6 +59,7 @@ let create (dummy : 'value_type) =
n_entries = 0;
names = [| "" |];
n_names = 0;
locked = false;
}
:
'value_type t
......@@ -69,7 +71,13 @@ let clear ia =
ia.entries <- [| None |];
ia.n_entries <- 0;
ia.names <- [| "" |];
ia.n_names <- 0
ia.n_names <- 0;
ia.locked <- false
;;
let lock ia b =
ia.locked <- b
;;
......@@ -121,6 +129,9 @@ let iter f ia =
let add ia name index opt_id value =
if ia.locked then
failwith ("It is currently not allowed to add a new interactor");
(* Check whether 'opt_id' is illegal *)
begin match opt_id with
None -> ()
......@@ -276,8 +287,8 @@ let unserialize f buf =
| T_tok(base_id,next_id,n_entries,n_names) ->
let l = buf.ds_end - buf.ds_pos in
if n_entries > l || n_names > l then failwith "Wd_interactor.unserialize";
let entries = Array.make n_entries None in
let names = Array.make n_names "" in
let entries = Array.make (max n_entries 1) None in
let names = Array.make (max n_names 1) "" in
for k = 0 to n_names - 1 do
names.(k) <- unserialize_string buf
done;
......@@ -298,21 +309,28 @@ let unserialize f buf =
entries = entries;
n_entries = n_entries;
names = names;
n_names = n_names
n_names = n_names;
locked = false
}
| _ ->
failwith "Wd_interactor.unserialize"
;;
let revision_interactor = "$Revision: 3.5 $" ;;
let revision_interactor = "$Revision: 3.6 $" ;;
(* Intentionally the CVS revision string *)
(* ======================================================================
* History:
*
* $Log: wd_interactor.ml,v $
* Revision 3.5 2005-06-11 14:24:14 stolpmann
* Revision 3.6 2005-12-09 20:02:40 stolpmann
* Fix in Wd_interactor.unserialize.
*
* The [interactors] are now locked in the "handle" stage of processing.
* Any trial will fail.
*
* Revision 3.5 2005/06/11 14:24:14 stolpmann
* Extension of bracket expressions: many new functions.
* Functions in bracket expressions may now lazily evaluate their arguments.
* ui:if and ui:ifvar may refer to any functions defined for bracket
......
......@@ -21,7 +21,7 @@
* </>
*)
(* $Id: wd_interactor.mli,v 3.6 2005-06-11 14:24:14 stolpmann Exp $
(* $Id: wd_interactor.mli,v 3.7 2005-12-09 20:02:40 stolpmann Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -177,6 +177,14 @@ val unserialize :
* the interactors. Values are read by calling [f].
*)
val lock : 'value_type t -> bool -> unit
(** Sets the locking flag. If this flag is [true], it is not allowed to [add]
* new interactors.
*
* After [create], [clear], and [unserialize] this flags is implicitly
* set to [false].
*)
(**/**)
val revision_interactor : string
......@@ -189,7 +197,13 @@ val revision_interactor : string
* History:
*
* $Log: wd_interactor.mli,v $
* Revision 3.6 2005-06-11 14:24:14 stolpmann
* Revision 3.7 2005-12-09 20:02:40 stolpmann
* Fix in Wd_interactor.unserialize.
*
* The [interactors] are now locked in the "handle" stage of processing.
* Any trial will fail.
*
* Revision 3.6 2005/06/11 14:24:14 stolpmann
* Extension of bracket expressions: many new functions.
* Functions in bracket expressions may now lazily evaluate their arguments.
* ui:if and ui:ifvar may refer to any functions defined for bracket
......
......@@ -21,7 +21,7 @@
* </>
*)
(* $Id: wd_types.ml,v 3.9 2005-06-11 14:24:14 stolpmann Exp $
(* $Id: wd_types.ml,v 3.10 2005-12-09 20:02:40 stolpmann Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -462,6 +462,8 @@ and virtual dialog_type =
(* MOSTLY INTERNAL USE:
* init p: re-initializes the dialog in order to go to page p.
*)
method lock_ia : bool -> unit
(* ONLY INTERNAL USE *)
method interactors : interactors
(* ONLY INTERNAL USE *)
......@@ -621,14 +623,20 @@ exception Instantiation_error of string
* catch this exception and report the error from its own view
*)
let revision_types = "$Revision: 3.9 $" ;;
let revision_types = "$Revision: 3.10 $" ;;
(* Intentionally the CVS revision string! *)
(* ======================================================================
* History:
*
* $Log: wd_types.ml,v $
* Revision 3.9 2005-06-11 14:24:14 stolpmann
* Revision 3.10 2005-12-09 20:02:40 stolpmann
* Fix in Wd_interactor.unserialize.
*
* The [interactors] are now locked in the "handle" stage of processing.
* Any trial will fail.
*
* Revision 3.9 2005/06/11 14:24:14 stolpmann
* Extension of bracket expressions: many new functions.
* Functions in bracket expressions may now lazily evaluate their arguments.
* ui:if and ui:ifvar may refer to any functions defined for bracket
......
......@@ -21,7 +21,7 @@
* </>
*)
(* $Id: wd_types.mli,v 3.12 2005-06-11 14:24:14 stolpmann Exp $
(* $Id: wd_types.mli,v 3.13 2005-12-09 20:02:40 stolpmann Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -575,6 +575,8 @@ and virtual dialog_type =
(* MOSTLY INTERNAL USE:
* init p: re-initializes the dialog in order to go to page p.
*)
method lock_ia : bool -> unit
(* ONLY INTERNAL USE *)
method interactors : interactors
(* ONLY INTERNAL USE *)
......@@ -892,7 +894,13 @@ val revision_types : string
* History:
*
* $Log: wd_types.mli,v $
* Revision 3.12 2005-06-11 14:24:14 stolpmann
* Revision 3.13 2005-12-09 20:02:40 stolpmann
* Fix in Wd_interactor.unserialize.
*
* The [interactors] are now locked in the "handle" stage of processing.
* Any trial will fail.
*
* Revision 3.12 2005/06/11 14:24:14 stolpmann
* Extension of bracket expressions: many new functions.
* Functions in bracket expressions may now lazily evaluate their arguments.
* ui:if and ui:ifvar may refer to any functions defined for bracket
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment