Skip to content

Commit 95a3417

Browse files
committed
ovis: allow explicitly releasing window
1 parent 82bd0c6 commit 95a3417

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

modules/ovis/include/opencv2/ovis.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ class CV_EXPORTS_W WindowScene {
8787
public:
8888
virtual ~WindowScene();
8989

90+
/**
91+
* closes window and releases the scene
92+
*
93+
* The method is automatically called by the destructor
94+
*/
95+
CV_WRAP virtual void release() = 0;
96+
9097
/**
9198
* set window background to custom image
9299
* @param image

modules/ovis/src/ovis.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,13 @@ class WindowSceneImpl : public WindowScene
392392
rWin->addViewport(cam);
393393
}
394394

395-
~WindowSceneImpl()
395+
~WindowSceneImpl() { release(); }
396+
397+
void release() CV_OVERRIDE
396398
{
399+
if(!sceneMgr)
400+
return;
401+
397402
if (flags & SCENE_SEPARATE)
398403
{
399404
TextureManager& texMgr = TextureManager::getSingleton();
@@ -433,6 +438,8 @@ class WindowSceneImpl : public WindowScene
433438
{
434439
_app->destroyWindow(title);
435440
}
441+
442+
sceneMgr = NULL;
436443
}
437444

438445
void setBackground(InputArray image) CV_OVERRIDE

0 commit comments

Comments
 (0)