[omniORB] Getting segmentation fault when I delete an array of structs

W T Meyer meyer at iastate.edu
Tue Jun 5 10:51:30 BST 2007


Removing the type cast indeed fixed the problem.  It was a classic 
case of making the problem harder than it was. Thanks for the help, Luke.

Regards,

Tom

At 07:14 PM 6/4/2007, Luke Deller wrote:
>W T Meyer wrote:
>...
> >   CoRCC::slotInfo* tempList = new CoRCC::slotInfo[24];
> >   status = rccref[rccHandle]->scanCrate((CoRCC::crateInfo_var)tempList);
>...
>
>The expression "(CoRCC::crateInfo_var)tempList" is not what you 
>want.  It will construct a temporary crateInfo_var instance which 
>will claim ownership of tempList.  When this temporary instance is 
>destroyed (right after that line of code) then the crateInfo_var 
>destructor will delete tempList.
>
> >   delete [] tempList;
>
>This line will delete tempList for the second time, which is why you 
>notice a segmentation fault here.
>
>Try removing the type cast.  If you want to use a _var type, then 
>you can declare tempList as that type.
>
>Regards,
>Luke.
>**********************************************************************************************
>Important Note
>This email (including any attachments) contains information which is 
>confidential and may be subject to legal privilege.  If you are not 
>the intended recipient you must not use, distribute or copy this 
>email.  If you have received this email in error please notify the
>sender immediately and delete this email. Any views expressed in 
>this email are not necessarily the views of IRESS Market Technology Limited.
>
>It is the duty of the recipient to virus scan and otherwise test the 
>information provided before loading onto any computer system.
>IRESS Market Technology Limited does not warrant that the 
>information is free of a virus or any other defect or error.
>**********************************************************************************************




More information about the omniORB-list mailing list