X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Ftexture2d.cpp;h=1e8e3db8fefe659a8b46390719e14177c29e5315;hb=da1e3f68e73cc0b6fb23e9dbae410cf9af3428a2;hp=311a3e4569704c92b99703c4a0473f508778c9e1;hpb=71ca61440610e650c6c1b761ebee1b587bbc969e;p=libs%2Fgl.git diff --git a/source/texture2d.cpp b/source/texture2d.cpp index 311a3e45..1e8e3db8 100644 --- a/source/texture2d.cpp +++ b/source/texture2d.cpp @@ -26,6 +26,7 @@ private: public: AsyncLoader(Texture2D &, IO::Seekable &); + ~AsyncLoader(); virtual bool needs_sync() const; virtual bool process(); @@ -249,6 +250,12 @@ Texture2D::AsyncLoader::AsyncLoader(Texture2D &t, IO::Seekable &i): phase(0) { } +Texture2D::AsyncLoader::~AsyncLoader() +{ + if(mapped_address) + pixel_buffer.unmap(); +} + bool Texture2D::AsyncLoader::needs_sync() const { return phase%2; @@ -276,6 +283,7 @@ bool Texture2D::AsyncLoader::process() else if(phase==3) { Bind _bind_buf(pixel_buffer, PIXEL_UNPACK_BUFFER); + mapped_address = 0; if(!pixel_buffer.unmap()) { phase = 1;