home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!mips!cs.uoregon.edu!nntp.uoregon.edu!news.u.washington.edu!milton.u.washington.edu!sinan
- From: sinan@milton.u.washington.edu (Sinan Karasu)
- Subject: Need to free local storage
- Message-ID: <1992Aug14.144015.17168@u.washington.edu>
- Keywords: Ada
- Sender: news@u.washington.edu (USENET News System)
- Organization: University of Washington, Seattle
- References: <>
- Date: Fri, 14 Aug 1992 14:40:15 GMT
- Lines: 62
-
-
- In the following code ( which is from Stars Xlib bindings) the lines
- flagged by -- sjw are needed in an Alsys environment,
- since otherwise we end up a memory leakage problem .. What does LRM say
- about this? is this a bug or normal ? is there a simple way to take care
- of this? Any suggestions are heartily welcome.
- -------------------------------------------------------------------------
-
- function set_event
- (untyped_event_record : x_crossing_event_record) return event_record
- is
- untyped_event : x_event :=
- new x_crossing_event_record'(untyped_event_record);
-
- procedure free is new unchecked_deallocation -- sjw
- (object => X_Crossing_Event_Record, -- sjw
- name => X_Event); -- sjw
-
- begin
- case event_type'val (untyped_event.kind) is
- when button_press =>
- declare
- the_x_event : x_button_event :=
- to_x_button_event (untyped_event);
- begin
- free(untyped_event); --sjw
- return
- (kind => button_press,
- serial => x_long_integer (the_x_event.serial),
- send_event => to_ada_boolean (the_x_event.send_event),
- display_id => the_x_event.display_id,
- window_id => to_ada_window (the_x_event.window_id),
- button =>
- (root => to_ada_window (the_x_event.root),
- subwindow => to_ada_window (the_x_event.subwindow),
- event_time => time (the_x_event.event_time),
- x => coordinate (the_x_event.x),
- y => coordinate (the_x_event.y),
- x_root => coordinate (the_x_event.x_root),
- y_root => coordinate (the_x_event.y_root),
- state => key_and_button_mask (to_mask (the_x_event.state)),
- button => button_name_type (the_x_event.button),
- same_screen =>
- to_ada_boolean (the_x_event.same_screen)));
- end;
- when button_release =>
- declare
- the_x_event : x_button_event :=
- to_x_button_event (untyped_event);
- begin
- free(untyped_event); -- sjw
- return
- (kind => button_release,
- serial => x_long_integer (the_x_event.serial),
- send_event => to_ada_boolean (the_x_event.send_event),
-
-
-
-
- --- Thanx for your help
- Sinan
-
-