Clean shutdown for Texture Transfer thread

This commit is contained in:
Zach Pomerantz 2016-04-11 12:43:49 -07:00
parent b758acb7d8
commit 1b7256d344
2 changed files with 12 additions and 0 deletions

View file

@ -44,6 +44,17 @@ GLTextureTransferHelper::GLTextureTransferHelper() {
_canvas->doneCurrent();
initialize(true, QThread::LowPriority);
_canvas->moveToThreadWithContext(_thread);
// Clean shutdown on UNIX, otherwise _canvas is freed early
connect(qApp, &QCoreApplication::aboutToQuit, [&] { terminate(); });
#endif
}
GLTextureTransferHelper::~GLTextureTransferHelper() {
#ifdef THREADED_TEXTURE_TRANSFER
if (isStillRunning()) {
terminate();
}
#endif
}

View file

@ -23,6 +23,7 @@ struct TextureTransferPackage {
class GLTextureTransferHelper : public GenericQueueThread<TextureTransferPackage> {
public:
GLTextureTransferHelper();
~GLTextureTransferHelper();
void transferTexture(const gpu::TexturePointer& texturePointer);
void postTransfer(const gpu::TexturePointer& texturePointer);