I have no problems saving a STAFHandlePtr into a struct in a C++ program. For example:
/* Contents of testHandle.cpp */ #include "STAF.h" struct Info { Info() {} STAFHandlePtr handle; STAFString handleNum; }; typedef STAFRefPtr<Info> InfoPtr; int main(int argc, char **argv) { InfoPtr ptr = InfoPtr(new Info(), InfoPtr::INIT); STAFHandlePtr handle; unsigned int rc = STAFHandle::create("MyApplication", handle); ptr->handleNum = STAFString(handle->getHandle()); ptr->handle = handle; cout << "ptr->handleNum=" << ptr->handleNum << endl; cout << "ptr->handle->getHandle()=" << ptr->handle->getHandle() << endl; return 0; } It runs fine as shown here: C:\>testHandle ptr->handleNum=18 ptr->handle->getHandle()=18 C:\> -------------------------------------------------------------- Sharon Lucas IBM Austin, luc...@us.ibm.com (512) 286-7313 or Tieline 363-7313 From: "Dedhia, Hardik" <hardik.ded...@netapp.com> To: <staf-users@lists.sourceforge.net>, Sharon Lucas/Austin/IBM@IBMUS, Date: 08/09/2011 09:35 AM Subject: [staf-users] Problem when putting a STAFHandlePtr in a struct Hi, I am trying to save the handle into a struct as follows struct info 21 { 22 char * machine_name; 23 char * pathToBinary; 24 char * pathToStorage; 25 char * filername; 26 STAFHandlePtr machine_handle; 27 STAFString hammer_handle; 28 }; STAFHandlePtr handle = getHandle("MyApplication"); //uses STAFHandle::create(applicationName, handle); ptr->machine_handle = handle; // This line seg faults. GDB backtrace points to: #0 0x00002aaaaaac83ed in STAFThreadSafeDecrement () from /usr/software/test/staf/current/lib/libSTAF.so #1 0x000000000040672c in STAFRefPtr<STAFHandle>::operator=(STAFRefPtr<STAFHandle> const&) () ptr->hammer_handle = hammer_handle; // hammer_handle is a STAFString. This line seg faults and GDB bt gives: #0 0x00002aaaaaaef801 in STAFStringDestruct () from /usr/software/test/staf/current/lib/libSTAF.so #1 0x0000000000406b1c in STAFString::operator=(STAFString const&) () Should there be any conversions before storing these data types into a struct? Thanks, Hardik. ------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users
<<image/gif>>
------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users