diff --git a/src/disposable.h b/src/disposable.h index 0704b17..e580ce1 100644 --- a/src/disposable.h +++ b/src/disposable.h @@ -42,15 +42,7 @@ struct DisposeWatch { typedef void (C::*NotifyFun)(); - /* The object owning the prop (and this helper) */ - C *owner; - /* Optional notify method */ - const NotifyFun notify; - /* Location of the prop pointer inside the owner */ - P *&propLocation; - sigc::connection dispCon; - - DisposeWatch(C *owner, P *&propLocation, NotifyFun notify = 0) + DisposeWatch(C &owner, P *&propLocation, NotifyFun notify = 0) : owner(owner), notify(notify), propLocation(propLocation) @@ -74,13 +66,21 @@ struct DisposeWatch } private: + /* The object owning the prop (and this helper) */ + C &owner; + /* Optional notify method */ + const NotifyFun notify; + /* Location of the prop pointer inside the owner */ + P * &propLocation; + sigc::connection dispCon; + void onDisposed() { dispCon.disconnect(); propLocation = 0; if (notify) - (owner->*notify)(); + (owner.*notify)(); } }; diff --git a/src/plane.cpp b/src/plane.cpp index 2f6ee55..3729016 100644 --- a/src/plane.cpp +++ b/src/plane.cpp @@ -67,7 +67,7 @@ struct PlanePrivate PlanePrivate() : bitmap(0), - bitmapWatch(this, bitmap), + bitmapWatch(*this, bitmap), opacity(255), blendType(BlendNormal), color(&tmp.color), diff --git a/src/sprite.cpp b/src/sprite.cpp index a2f9197..6a1913e 100644 --- a/src/sprite.cpp +++ b/src/sprite.cpp @@ -89,7 +89,7 @@ struct SpritePrivate SpritePrivate() : bitmap(0), - bitmapWatch(this, bitmap), + bitmapWatch(*this, bitmap), srcRect(&tmp.rect), mirrored(false), bushDepth(0), diff --git a/src/tilemap.cpp b/src/tilemap.cpp index 09d5136..f65df29 100644 --- a/src/tilemap.cpp +++ b/src/tilemap.cpp @@ -355,7 +355,7 @@ struct TilemapPrivate TilemapPrivate(Viewport *viewport) : viewport(viewport), tileset(0), - tilesetWatch(this, tileset), + tilesetWatch(*this, tileset), mapData(0), flashData(0), priorities(0), diff --git a/src/window.cpp b/src/window.cpp index 7dc46ce..6f985fd 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -250,9 +250,9 @@ struct WindowPrivate WindowPrivate(Viewport *viewport = 0) : windowskin(0), - windowskinWatch(this, windowskin), + windowskinWatch(*this, windowskin), contents(0), - contentsWatch(this, contents, &WindowPrivate::markControlVertDirty), + contentsWatch(*this, contents, &WindowPrivate::markControlVertDirty), bgStretch(true), cursorRect(&tmp.rect), active(true),