File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,13 @@ class CV_EXPORTS_W WindowScene {
8787public:
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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments