diff options
author | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2012-03-27 13:50:59 +0000 |
---|---|---|
committer | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2012-03-27 13:50:59 +0000 |
commit | 9a020aa5c539b5234a029fc0728e6d6b59461c83 (patch) | |
tree | 8a89c400bb5c75671c1876ddd2d711d87f0e6fc1 | |
parent | b582e93d1fa1b7e193b3d6ca14b4a356b4ec6503 (diff) | |
download | ATCD-9a020aa5c539b5234a029fc0728e6d6b59461c83.tar.gz |
Tue Mar 27 14:50:00 UTC 2012 Simon Massey <simon dot massey at prismtech dot com>
compressor_factory_ should not be a var just a pointer. Each compressor is passed in the "this" pointer of the factory that created it (which holds each compressor that is created inside it in it's own var). When it comes to delete the factory, each compressor held within the factory will keep the factory reference count artificially high so it does not get deleted and so the compressors it holds are also not deleted. Basically the var creates a circular reference counted chain of objects. Now the compressors simply hold a pointer to the factory, when the factory is deleted, each contained compressor will also be deleted.
-rw-r--r-- | TAO/ChangeLog | 14 | ||||
-rw-r--r-- | TAO/tao/Compression/Base_Compressor.cpp | 5 | ||||
-rw-r--r-- | TAO/tao/Compression/Base_Compressor.h | 2 |
3 files changed, 17 insertions, 4 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 8afbde3df15..c762c3cf294 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,17 @@ +Tue Mar 27 14:50:00 UTC 2012 Simon Massey <simon dot massey at prismtech dot com> + + * tao/Compression/Base_Compressor.cpp: + * tao/Compression/Base_Compressor.h: + compressor_factory_ should not be a var just a pointer. Each compressor is + passed in the "this" pointer of the factory that created it (which holds + each compressor that is created inside it in it's own var). When it comes + to delete the factory, each compressor held within the factory will keep the + factory reference count artificially high so it does not get deleted and + so the compressors it holds are also not deleted. Basically the var creates a + circular reference counted chain of objects. Now the compressors simply hold a + pointer to the factory, when the factory is deleted, each contained compressor + will also be deleted. + Tue Mar 27 13:17:00 UTC 2012 Simon Massey <simon dot massey at prismtech dot com> * tao/ORB_Core.cpp: diff --git a/TAO/tao/Compression/Base_Compressor.cpp b/TAO/tao/Compression/Base_Compressor.cpp index 09c50e23c6c..b0ac64317ef 100644 --- a/TAO/tao/Compression/Base_Compressor.cpp +++ b/TAO/tao/Compression/Base_Compressor.cpp @@ -10,8 +10,7 @@ namespace TAO ::Compression::CompressorFactory_ptr compressor_factory, ::Compression::CompressionLevel compression_level) : compression_level_ (compression_level), - compressor_factory_ (::Compression::CompressorFactory::_duplicate ( - compressor_factory)), + compressor_factory_ (compressor_factory), compressed_bytes_ (0), uncompressed_bytes_ (0) { @@ -21,7 +20,7 @@ namespace TAO BaseCompressor::compressor_factory (void) { return ::Compression::CompressorFactory::_duplicate ( - compressor_factory_.in ()); + compressor_factory_); } ::Compression::CompressionLevel diff --git a/TAO/tao/Compression/Base_Compressor.h b/TAO/tao/Compression/Base_Compressor.h index 38708cd241f..c3911056228 100644 --- a/TAO/tao/Compression/Base_Compressor.h +++ b/TAO/tao/Compression/Base_Compressor.h @@ -61,7 +61,7 @@ namespace TAO TAO_SYNCH_MUTEX mutex_; ::Compression::CompressionLevel compression_level_; - ::Compression::CompressorFactory_var compressor_factory_; + ::Compression::CompressorFactory *compressor_factory_; ::CORBA::ULongLong compressed_bytes_; ::CORBA::ULongLong uncompressed_bytes_; }; |