Skip to content

Commit e639c8e

Browse files
committed
ovis: correctly destroy additional windows
1 parent 20dbe78 commit e639c8e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

modules/ovis/samples/ovis_demo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@
3131
while cv.ovis.waitKey(1) != 27:
3232
R, t = iwin.getCameraPose()
3333
owin.setEntityPose("cam", t, R)
34+
35+
del iwin # must be destroyed in reverse creation order

modules/ovis/src/ovis.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,20 @@ struct Application : public OgreBites::ApplicationContext, public OgreBites::Inp
238238
return ret;
239239
}
240240

241+
#if OGRE_VERSION < ((1 << 16) | (12 << 8) | 3)
242+
void destroyWindow(const Ogre::String& name)
243+
{
244+
for (auto it = mWindows.begin(); it != mWindows.end(); ++it)
245+
{
246+
if (it->render->getName() != name)
247+
continue;
248+
mRoot->destroyRenderTarget(it->render);
249+
mWindows.erase(it);
250+
return;
251+
}
252+
}
253+
#endif
254+
241255
size_t numWindows() const { return mWindows.size(); }
242256

243257
void locateResources() CV_OVERRIDE
@@ -371,6 +385,10 @@ class WindowSceneImpl : public WindowScene
371385
_app->closeApp();
372386
_app.release();
373387
}
388+
else
389+
{
390+
_app->destroyWindow(title);
391+
}
374392
}
375393

376394
void setBackground(InputArray image) CV_OVERRIDE

0 commit comments

Comments
 (0)