diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-02-18 00:06:41 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-02-20 17:12:20 +0000 |
commit | ca6d45fff41bb4765bfc6b3c72e8fad224273ff1 (patch) | |
tree | 4af7656dafb84f0062a85e23676aaec857ba3a86 | |
parent | 7bec16ea0e67d81a1fdf2022cb0985acc51dc691 (diff) |
pyuno: decreaseRefCount: valgrind warning:
Apparently the thread spawned in decreaseRefCount runs and deletes
itself before the "m_hThread != 0" from osl::Thread::create is executed;
try a lame workaround for that.
==1877== Invalid read of size 8
==1877== at 0x2A70E546: osl::Thread::create() (in pyuno/unxlngx6/lib/libpyuno.so)
==1877== by 0x2A70E351: pyuno::decreaseRefCount(_is*, _object*) (in pyuno/unxlngx6/lib/libpyuno.so)
==1877== by 0x2A7092B4: pyuno::Adapter::~Adapter() (in pyuno/unxlngx6/lib/libpyuno.so)
==1877== by 0x2A709393: pyuno::Adapter::~Adapter() (in pyuno/unxlngx6/lib/libpyuno.so)
==1877== by 0x5EF2F64: cppu::OWeakObject::release() (weak.cxx:213)
==1877== by 0x2A70DE69:
==1877== Address 0x1ee30818 is 8 bytes inside a block of size 32 free'd
==1877== at 0x4A0662E: free (vg_replace_malloc.c:366)
==1877== by 0x4C44B62: rtl_freeMemory_SYSTEM(void*) (alloc_global.cxx:285)
==1877== by 0x4C44DC7: rtl_freeMemory (alloc_global.cxx:355)
==1877== by 0x2A70E41E: osl::Thread::operator delete(void*) (in pyuno/unxlngx6/lib/libpyuno.so)
==1877== by 0x2A70E6EF: pyuno::GCThread::~GCThread() (in pyuno/unxlngx6/lib/libpyuno.so)
==1877== by 0x2A70E303: pyuno::GCThread::onTerminated() (in pyuno/unxlngx6/lib/libpyuno.so)
==1877== by 0x2A70E671: threadFunc (in pyuno/unxlngx6/lib/libpyuno.so)
==1877== by 0x4C2E242: osl_thread_start_Impl (thread.c:292)
==1877== by 0x3C26607D8F: start_thread (pthread_create.c:309)
==1877== by 0x3C262EF48C: clone (clone.S:115)
Signed-off-by: a very sceptical Michael Meeks <michael.meeks@suse.com>
-rw-r--r-- | pyuno/source/module/pyuno_gc.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pyuno/source/module/pyuno_gc.cxx b/pyuno/source/module/pyuno_gc.cxx index 77eb6885d04e..13e6013d5941 100644 --- a/pyuno/source/module/pyuno_gc.cxx +++ b/pyuno/source/module/pyuno_gc.cxx @@ -112,7 +112,10 @@ void decreaseRefCount( PyInterpreterState *interpreter, PyObject *object ) // interpreter lock is held or not // TODO: Look for a more efficient solution osl::Thread *t = new GCThread( interpreter, object ); - t->create(); + // don't call create() because Valgrind complains about invalid read in + // the rather bizarre GCThread::onTerminated; try a lame workaround: + t->createSuspended(); + t->resume(); } } |