Fixed a deadlock.

This commit is contained in:
Matthias Koefferlein 2018-07-13 08:08:15 +02:00
parent 61a37fc3c3
commit cf3a6c2ce5
2 changed files with 8 additions and 2 deletions

View File

@ -121,7 +121,7 @@ Proxy::release ()
// and then make us the owner
const gsi::ClassBase *cls = m_cls_decl;
if (cls && cls->is_managed ()) {
void *o = obj ();
void *o = obj_internal ();
if (o) {
cls->gsi_object (o)->keep ();
}
@ -138,7 +138,7 @@ Proxy::keep ()
const gsi::ClassBase *cls = m_cls_decl;
if (cls) {
void *o = obj ();
void *o = obj_internal ();
if (o) {
if (cls->is_managed ()) {
cls->gsi_object (o)->keep ();
@ -172,7 +172,12 @@ void *
Proxy::obj ()
{
QMutexLocker locker (&m_lock);
return obj_internal ();
}
void *
Proxy::obj_internal ()
{
if (! m_obj) {
if (m_destroyed) {
throw tl::Exception (tl::to_string (QObject::tr ("Object has been destroyed already")));

View File

@ -245,6 +245,7 @@ private:
void *set_internal (void *obj, bool owned, bool const_ref, bool can_destroy);
void object_status_changed (gsi::ObjectBase::StatusEventType type);
void detach_internal ();
void *obj_internal ();
};
}