openframeworks / openframeworks/openFrameworks
currentWindow (member of ofMainLoop) is not reset() after ofAppGLFWWindow->close()
@ofTheo is already working on this.
Since Jul 7, 2016.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
When starting an ofBaseApp in a thread inside a host application, and closing using:
ofExit();
ofAppGLFWWindow->close();
//std::shared_ptr empty;
//ofGetMainLoop()->setCurrentWindow(empty);
currentWindow still holds a reference.
Trying to restart ofBaseApp a second time will crash at:
glDeleteTextures() at 0x7ffff75b7bc9
release() at ofTexture.cpp:140 0x60778d
ofTexture::~ofTexture() at ofTexture.cpp:265 0x607ec6
ofBitmapFont::~ofBitmapFont() at ofBitmapFont.cpp:457 0x6186b0
ofGLRenderer::~ofGLRenderer() at ofGLRenderer.h:20 0x5f1441
ofGLRenderer::~ofGLRenderer() at ofGLRenderer.h:20 0x5f1526
std::_Sp_counted_ptr<ofGLRenderer*, () at shared_ptr_base.h:290 0x5d8d5a
std::_Sp_counted_base<() at shared_ptr_base.h:144 0x4295ea
std::__shared_count<() at shared_ptr_base.h:546 0x4294bb
std::__shared_ptr<ofBaseRenderer, () at shared_ptr_base.h:781 0x46940c
std::shared_ptr::~shared_ptr() at shared_ptr.h:93 0x469426
ofAppGLFWWindow::~ofAppGLFWWindow() at ofAppGLFWWindow.cpp:55 0x5d3421
ofAppGLFWWindow::~ofAppGLFWWindow() at ofAppGLFWWindow.cpp:57 0x5d346c
std::_Sp_counted_ptr<ofAppGLFWWindow*, () at shared_ptr_base.h:290 0x458386
std::_Sp_counted_base<() at shared_ptr_base.h:144 0x4295ea
std::__shared_count<() at shared_ptr_base.h:565 0x436f8a
std::__shared_ptr<ofAppBaseWindow, () at shared_ptr_base.h:843 0x43be37
std::shared_ptr::operator=() at shared_ptr.h:274 0x43b673
ofMainLoop::addWindow() at ofMainLoop.h:27 0x43b153
ofMainLoop::createWindow() at ofMainLoop.cpp:65 0x440eb9
ofCreateWindow() at ofAppRunner.cpp:196 0x439983
I use this workaround to solve the problem without affecting OF:
//std::shared_ptr empty;
//ofGetMainLoop()->setCurrentWindow(empty);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.