home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / ada / 2362 < prev    next >
Encoding:
Text File  |  1992-08-14  |  3.2 KB  |  75 lines

  1. Newsgroups: comp.lang.ada
  2. 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
  3. From: sinan@milton.u.washington.edu (Sinan Karasu)
  4. Subject: Need to free local storage
  5. Message-ID: <1992Aug14.144015.17168@u.washington.edu>
  6. Keywords: Ada
  7. Sender: news@u.washington.edu (USENET News System)
  8. Organization: University of Washington, Seattle
  9. References: <>
  10. Date: Fri, 14 Aug 1992 14:40:15 GMT
  11. Lines: 62
  12.  
  13.    
  14. In the following code ( which is from Stars Xlib bindings) the lines
  15. flagged by -- sjw are needed in an Alsys environment, 
  16. since otherwise we end up a memory leakage problem .. What does LRM say 
  17. about this? is this a bug or normal ? is there a simple way to take care 
  18. of this? Any suggestions are heartily welcome.
  19. -------------------------------------------------------------------------
  20.  
  21.       function set_event
  22.           (untyped_event_record : x_crossing_event_record) return event_record
  23.           is
  24.          untyped_event : x_event :=
  25.             new x_crossing_event_record'(untyped_event_record);
  26.  
  27.          procedure free is new unchecked_deallocation -- sjw
  28.            (object => X_Crossing_Event_Record,        -- sjw
  29.             name   => X_Event);                       -- sjw
  30.  
  31.       begin
  32.          case event_type'val (untyped_event.kind) is
  33.             when button_press  =>
  34.                declare
  35.                   the_x_event : x_button_event :=
  36.                      to_x_button_event (untyped_event);
  37.                begin
  38.                   free(untyped_event); --sjw
  39.                   return
  40.                      (kind       => button_press,
  41.                       serial => x_long_integer (the_x_event.serial),
  42.                       send_event => to_ada_boolean (the_x_event.send_event),
  43.                       display_id => the_x_event.display_id,
  44.                       window_id  => to_ada_window (the_x_event.window_id),
  45.                       button =>
  46.                          (root => to_ada_window (the_x_event.root),
  47.                           subwindow => to_ada_window (the_x_event.subwindow),
  48.                           event_time => time (the_x_event.event_time),
  49.                           x => coordinate (the_x_event.x),
  50.                           y => coordinate (the_x_event.y),
  51.                           x_root => coordinate (the_x_event.x_root),
  52.                           y_root => coordinate (the_x_event.y_root),
  53.                           state => key_and_button_mask (to_mask (the_x_event.state)),
  54.                           button => button_name_type (the_x_event.button),
  55.                           same_screen =>
  56.                              to_ada_boolean (the_x_event.same_screen)));
  57.                end;
  58.             when button_release     =>
  59.                declare
  60.                   the_x_event : x_button_event :=
  61.                      to_x_button_event (untyped_event);
  62.                begin
  63.                   free(untyped_event); -- sjw
  64.                   return
  65.                      (kind       => button_release,
  66.                       serial => x_long_integer (the_x_event.serial),
  67.                       send_event => to_ada_boolean (the_x_event.send_event),
  68.  
  69.  
  70.  
  71.  
  72.   --- Thanx for your help
  73.       Sinan
  74.  
  75.