Disposable: Emit 'wasDisposed' on destruction, not dispose()

Fixes segfaults when objects that were not explicitly disposed
were collected by the GC.
This commit is contained in:
Jonas Kulla 2014-08-16 04:07:39 +02:00
parent b32d6c69cb
commit 3887342439
3 changed files with 5 additions and 6 deletions

View File

@ -70,9 +70,6 @@ RB_METHOD(disposableDispose)
if (!c) if (!c)
return Qnil; return Qnil;
/* Inform core */
c->wasDisposed();
disposableDisposeChildren(self); disposableDisposeChildren(self);
delete c; delete c;

View File

@ -72,9 +72,6 @@ MRB_METHOD(disposableDispose)
if (!c) if (!c)
return mrb_nil_value(); return mrb_nil_value();
/* Inform core */
c->wasDisposed();
disposableDisposeChildren(mrb, self); disposableDisposeChildren(mrb, self);
delete c; delete c;

View File

@ -30,6 +30,11 @@
class Disposable class Disposable
{ {
public: public:
~Disposable()
{
wasDisposed();
}
sigc::signal<void> wasDisposed; sigc::signal<void> wasDisposed;
}; };