From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_00,PDS_OTHER_BAD_TLD, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,dbbbb21ed7f581b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!news.glorb.com!newsfeed.straub-nv.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Operation can be dispatching in only one type Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <025105f2-5571-400e-a66f-ef1c3dc9ef32@g27g2000yqn.googlegroups.com> <39kf90ha60px$.d7746cf5cx6h.dlg@40tude.net> <691d6892-bc5e-4d81-8025-c36556bf2593@13g2000prl.googlegroups.com> <1h9hilcg5i6il.12edpgu4szw1h.dlg@40tude.net> <1wtsriaxu0s4s$.ikwnnz5teukp$.dlg@40tude.net> <1iipp3bn16fe2.yqa1gz1ru17a$.dlg@40tude.net> <18wh86jvjvoe0.cofxcc8udm6q$.dlg@40tude.net> <53a35ed9-88ac-43dc-b2a2-8d6880802328@j19g2000yqk.googlegroups.com> <4b091fb9$0$6567$9b4e6d93@newsspool4.arcor-online.net> <1w0q3zxzw79pt$.5z0juiky7kfd$.dlg@40tude.net> <0f177771-381e-493b-92bb-28419dfbe4e6@k19g2000yqc.googlegroups.com> Date: Sun, 22 Nov 2009 18:41:02 +0100 Message-ID: <1nbcfi99y0fkg.1h5ox2lj73okx$.dlg@40tude.net> NNTP-Posting-Date: 22 Nov 2009 18:41:01 CET NNTP-Posting-Host: 6334ab75.newsspool1.arcor-online.net X-Trace: DXC=9RRT@Th0:TJ74okIm;?DS@ic==]BZ:afN4Fo<]lROoRA<`=YMgDjhgBdSh9VMa?D0H[6LHn;2LCVN[ On Sun, 22 Nov 2009 08:52:05 -0800 (PST), xorque wrote: > On Nov 22, 4:42�pm, "Dmitry A. Kazakov" > wrote: >> On Sun, 22 Nov 2009 08:27:59 -0800 (PST), xorque wrote: >>> Not sure which part of the code you're referring to here. >> >> The function Open_Archive returns a new object. In Main you call it and >> then apply the function Stream to the result. Stream returns an access to >> the component File of the temporal object created by Open_Archive. Then >> this object is destroyed and a dangling pointer is assigned to S. When you >> call Integer'Inpit on S, it accesses a garbage. > > Ah, I see what you mean. > > In the process of trying to save the result of Open_Archive so that I > can test > if this problem still occurs, I've run into another problem: > > A : Archiver.Archiver_t; > O : constant Archiver.Archive_t := Archiver.Archive_t > (Archiver.Open_Archive (A, "file.zip")); > S : constant Stream_IO.Stream_Access := Archiver.Stream (O); > > main.adb:9:46: illegal context for call to function with limited > result > > I have to admit to not understanding that error. And I don't understand your design. If Archive is a Stream derive then it from Root_Stream_Type. If it deals with a stream then pass Root_Stream_Type'Class to the operations that need it. But never ever return pointers to components without an urgent need. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de