[omniORB] Problem of CORBA::String in MFC Application

Renzo Tomaselli renzo.tomaselli@tecnotp.it
Fri, 26 Nov 1999 17:11:18 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_003C_01BF3831.40CFB3D0
Content-Type: text/plain;
	charset="gb2312"
Content-Transfer-Encoding: quoted-printable

Jeffrey,
        be careful not to mix debug/release versions of MSVC runtimes. I =
you do this and string allocation is performed by OmniORB libs in one =
mode while your code is linked the other way, you get the result you =
describe, since two different heaps are involved.

                                             Renzo Tomaselli

----- Original Message -----=20
  From: Jeffrey Du=20
  To: omniorb-list@uk.research.att.com=20
  Sent: domenica 5 dicembre 1999 5.26
  Subject: [omniORB] Problem of CORBA::String in MFC Application


     I am writing a CORBA program in VC++ 5.0 using omniORB 2.8 in =
Windows95. I find that
  any functions in my program using CORBA::String will encounter an =
error when they return.
  For example, here is my code of the function:
  =20
  int CWSInfoApp::InitCorbaServer()
  {
     ......=20
     CORBA::String_var p =3D orb->object_to_string(myobj);
     ......=20
  =20
     return(0); // an error occurs after return
  }
  =20
     And the error message is:
  =20
     Microsoft Visual C++ Debug Library
          Debug Assertion Failed
          Program:  .....
          File: dbgdel.cpp
          Line: 47
          Exception: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
  =20
     I think the error occurs when releasing CORBA::String memory.=20
     Please tell me how to solve this problem.
  =20
     Jeffrey Du
     jeffdu@163.net

------=_NextPart_000_003C_01BF3831.40CFB3D0
Content-Type: text/html;
	charset="gb2312"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dwindows-1252" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#c0c0c0>
<DIV><FONT size=3D2>Jeffrey,</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; be careful not =
to mix=20
debug/release versions of MSVC runtimes. I you do this and string =
allocation is=20
performed by OmniORB libs in one mode while your code is linked the =
other way,=20
you get the result you describe, since two different heaps are=20
involved.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Renzo Tomaselli</FONT></DIV>
<DIV><FONT size=3D2><BR></FONT>----- Original Message ----- </DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A href=3D"mailto:jeffdu@163.net" title=3Djeffdu@163.net>Jeffrey =
Du</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
  href=3D"mailto:omniorb-list@uk.research.att.com"=20
  =
title=3Domniorb-list@uk.research.att.com>omniorb-list@uk.research.att.com=
</A>=20
  </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> domenica 5 dicembre 1999 =
5.26</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [omniORB] Problem of=20
  CORBA::String in MFC Application</DIV>
  <DIV><BR></DIV>
  <DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; I am writing a CORBA =
program in=20
  VC++ 5.0 using omniORB 2.8 in Windows95. I find that</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2>any functions in my program using=20
  CORBA::String will encounter an error when they return.</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2>For example, here is my code of =
the=20
  function:</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 size=3D2>int =
CWSInfoApp::InitCorbaServer()</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT><FONT =
size=3D2>{</FONT></DIV>
  <DIV><FONT size=3D2>&nbsp;&nbsp; ......</FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; CORBA::String_var p =
=3D=20
  orb-&gt;object_to_string(myobj);</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; =
......</FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; return(0); // an =
error occurs=20
  after return</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT><FONT color=3D#000000=20
  size=3D2>}</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; And the error message =

  is:</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; Microsoft Visual C++ =
Debug=20
  Library</FONT></DIV>
  <DIV><FONT color=3D#000000 =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  Debug Assertion Failed</FONT></DIV>
  <DIV><FONT color=3D#000000 =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  Program:&nbsp; .....</FONT></DIV>
  <DIV><FONT color=3D#000000 =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  File: dbgdel.cpp</FONT></DIV>
  <DIV><FONT color=3D#000000 =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  Line: 47</FONT></DIV>
  <DIV><FONT color=3D#000000 =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  Exception: _BLOCK_TYPE_IS_VALID(pHead-&gt;nBlockUse)</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; I think the error =
occurs when=20
  releasing CORBA::String memory. </FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; Please tell me how to =
solve this=20
  problem.</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; Jeffrey =
Du</FONT></DIV>
  <DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; <A=20
  =
href=3D"mailto:jeffdu@163.net">jeffdu@163.net</A></FONT></DIV></DIV></BLO=
CKQUOTE></BODY></HTML>

------=_NextPart_000_003C_01BF3831.40CFB3D0--