diff --git a/applications/gui2/src/main.cpp b/applications/gui2/src/main.cpp index e704df5c7bf89f05c74d0673305c039f63db6d64..ead435858ded235605ed9ded1611e73deb578290 100644 --- a/applications/gui2/src/main.cpp +++ b/applications/gui2/src/main.cpp @@ -182,10 +182,11 @@ int main(int argc, char **argv) { #endif return -1; } - - nanogui::shutdown(); } + // Must be after ~FTLGui since it destroys GL context. + nanogui::shutdown(); + // Save config changes and delete final objects ftl::config::cleanup(); diff --git a/applications/gui2/src/widgets/imageview.cpp b/applications/gui2/src/widgets/imageview.cpp index 3ef6f5c69319f0f831f30a840556213ca4b0be1f..79117634676e7f4ceeb452ef39eed47f8760f673 100644 --- a/applications/gui2/src/widgets/imageview.cpp +++ b/applications/gui2/src/widgets/imageview.cpp @@ -466,6 +466,9 @@ void ftl::gui2::ImageView::writePixelInfo(NVGcontext* ctx, const Vector2f& cellP //////////////////////////////////////////////////////////////////////////////// +FTLImageView::~FTLImageView() { +} + void FTLImageView::draw(NVGcontext* ctx) { if (texture_.isValid()) { ImageView::draw(ctx); } } diff --git a/applications/gui2/src/widgets/imageview.hpp b/applications/gui2/src/widgets/imageview.hpp index c54a0f531c976bd96e1227fb2a5b99813d76a5bc..94d3d59c9b3013abcc6cff42fd7d74b44a6b083a 100644 --- a/applications/gui2/src/widgets/imageview.hpp +++ b/applications/gui2/src/widgets/imageview.hpp @@ -35,7 +35,7 @@ namespace gui2 { class NANOGUI_EXPORT ImageView : public nanogui::Widget { public: ImageView(nanogui::Widget* parent, GLuint imageID = -1); - ~ImageView(); + virtual ~ImageView(); void bindImage(GLuint imageId); @@ -187,6 +187,10 @@ public: class FTLImageView : public ImageView { public: using ImageView::ImageView; + + FTLImageView(nanogui::Widget* parent, GLuint imageID = -1) : ImageView(parent, imageID) {} + ~FTLImageView(); + virtual void draw(NVGcontext* ctx) override; virtual nanogui::Vector2i preferredSize(NVGcontext* ctx) const override; diff --git a/components/renderers/cpp/src/gltexture.cpp b/components/renderers/cpp/src/gltexture.cpp index 324739f55028ec22b14d47bfceaba42524020efb..2bb106ecd0a225fe27f0dcf099c57720135518c4 100644 --- a/components/renderers/cpp/src/gltexture.cpp +++ b/components/renderers/cpp/src/gltexture.cpp @@ -27,7 +27,7 @@ GLTexture::GLTexture() { } GLTexture::~GLTexture() { - //glDeleteTextures(1, &glid_); + free(); // Note: Do not simply remove this... } void GLTexture::make(int width, int height, Type type) { diff --git a/components/structures/include/ftl/data/new_frame.hpp b/components/structures/include/ftl/data/new_frame.hpp index 7d779a68f41905d260033c7910f9061677a69073..1533e034a081e10e4a6757691dd2686ced5dde18 100644 --- a/components/structures/include/ftl/data/new_frame.hpp +++ b/components/structures/include/ftl/data/new_frame.hpp @@ -172,7 +172,7 @@ class Frame { protected: // Only Feed class should construct - Frame(Pool *ppool, Session *parent, FrameID pid, int64_t ts) : timestamp_(ts), id_(pid), pool_(ppool), parent_(parent), status_(FrameStatus::CREATED) {}; + Frame(Pool *ppool, Session *parent, FrameID pid, int64_t ts); int64_t timestamp_=0; FrameID id_; diff --git a/components/structures/src/new_frame.cpp b/components/structures/src/new_frame.cpp index 88619e19ee2e8e65ef2da538ca396c2cc1266475..64f64846bff2102c61ea5b98801eeaa6885f5941 100644 --- a/components/structures/src/new_frame.cpp +++ b/components/structures/src/new_frame.cpp @@ -67,10 +67,20 @@ void ftl::data::setTypeEncoder(size_t type, const std::function<bool(const ftl:: //============================================================================== +//static std::atomic_int frame_count = 0; + +Frame::Frame(Pool *ppool, Session *parent, FrameID pid, int64_t ts) + : timestamp_(ts), id_(pid), pool_(ppool), parent_(parent), status_(FrameStatus::CREATED) { + //LOG(INFO) << "Frames: " << ++frame_count; + }; + Frame::~Frame() { if (status_ == FrameStatus::CREATED) store(); if (status_ == FrameStatus::STORED) flush(); - if (status_ != FrameStatus::RELEASED && pool_) pool_->release(*this); + if (status_ != FrameStatus::RELEASED && pool_) { + pool_->release(*this); + //--frame_count; + } }; bool ftl::data::Frame::hasAll(const std::unordered_set<ftl::codecs::Channel> &cs) {