[odb-users] Segmentation fault when loading an unpersisted object
 through lazy_shared_ptr::load()
    Stefano Sartor 
    sartor at oats.inaf.it
       
    Tue May 21 11:55:35 EDT 2013
    
    
  
Dear odb-users,
I'm developing a library which wraps ODB and offers to the end users a 
simplified API.
I use vectors of both lazy_shared_ptrs and lazy_weak_ptr for storing 
associations.
The setters and getters in the attached code should provide an 
homogeneous access on the associations containers.
Unfortunately, on transient objects, only the weak_objects() getter 
works because the lazy_weak_ptr::load() correctly detects that the 
weak_pointer is already initialized and returns the shared_ptr from the 
lock() method.
The lazy_shared_ptr::load() instead of returning just the internal 
shared_ptr (on transient objects), always tries to load the object, 
causing a segmentation fault.
I couldn't find any other way to get a shared_ptr from a lazy_shared_ptr.
Note that I generate odb-files with --default-pointer std::tr1::shared_ptr.
Some environment information:
obd 2.2.1
libodb 2.2
libodb-mysql 2.2
libodb-boost 2.2
g++ 4.7.2
running on ubuntu 12.10 x86_64
best regards,
Stefano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.tar.gz
Type: application/x-gzip
Size: 10240 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20130521/aae6dc7f/example.tar.bin
    
    
More information about the odb-users
mailing list