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)
return Qnil;
/* Inform core */
c->wasDisposed();
disposableDisposeChildren(self);
delete c;

View File

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

View File

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