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:
parent
b32d6c69cb
commit
3887342439
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -30,6 +30,11 @@
|
||||||
class Disposable
|
class Disposable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~Disposable()
|
||||||
|
{
|
||||||
|
wasDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
sigc::signal<void> wasDisposed;
|
sigc::signal<void> wasDisposed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue