Skip to content

Commit 7823fef

Browse files
authored
Merge pull request #2173 from SCIInstitute/select-windows-crash
Fix ViewScene destructor crash after selecting a widget
2 parents 9116c11 + 4a1b146 commit 7823fef

File tree

6 files changed

+225
-196
lines changed

6 files changed

+225
-196
lines changed

src/Externals/spire/es-render/FBOMan.cpp

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -179,26 +179,23 @@ namespace ren {
179179
GLsizei npixelx, GLsizei npixely, GLsizei npixelz,
180180
const std::string& assetName)
181181
{
182-
//get fbo
183-
//uint64_t containerID = spire::getESTypeID<ren::FBO>();
184-
//spire::BaseComponentContainer* container =
185-
// core.getComponentContainer(containerID);
186-
//spire::CerealHeap<ren::FBO>* contFBO =
187-
// dynamic_cast<spire::CerealHeap<ren::FBO>*>(container);
188-
spire::CerealHeap<ren::FBO>* contFBO =
189-
core.getOrCreateComponentContainer<ren::FBO>();
190-
std::pair<const ren::FBO*, size_t> component =
191-
contFBO->getComponent(getEntityIDForName(assetName));
192-
if (component.first == nullptr)
182+
auto contFBO = core.getOrCreateComponentContainer<ren::FBO>();
183+
auto component = contFBO->getComponent(getEntityIDForName(assetName));
184+
if (!component.first)
185+
{
193186
return createFBO(core, ttype, npixelx, npixely, npixelz, assetName);
187+
}
194188
else
195189
{
196190
FBOData fboData = getFBOData(assetName);
197-
if (fboData.numPixelsX == npixelx &&
198-
fboData.numPixelsY == npixely)
191+
if (fboData.numPixelsX == npixelx && fboData.numPixelsY == npixely)
192+
{
199193
return component.first->glid;
194+
}
200195
else
196+
{
201197
return resizeFBO(core, assetName, npixelx, npixely, npixelz);
198+
}
202199
}
203200
}
204201

@@ -296,7 +293,6 @@ namespace ren {
296293
return it->second;
297294
}
298295
}
299-
300296
throw std::runtime_error("FBOMan: Unable to find FBO data");
301297
}
302298

@@ -352,7 +348,7 @@ namespace ren {
352348
// GARBAGE COLLECTION
353349
//------------------------------------------------------------------------------
354350

355-
void FBOMan::runGCAgainstVaidIDs(const std::set<GLuint>& validKeys)
351+
void FBOMan::runGCAgainstValidIDs(const std::set<GLuint>& validKeys)
356352
{
357353
// Every GLuint in validKeys should be in our map. If there is not, then
358354
// there is an error in the system, and it should be reported.
@@ -374,7 +370,7 @@ namespace ren {
374370

375371
if (it == mFBOData.end())
376372
{
377-
std::cerr << "runGCAgainstVaidIDs: terminating early, validKeys contains "
373+
std::cerr << "runGCAgainstValidIDs: terminating early, validKeys contains "
378374
<< "elements not in FBO map." << std::endl;
379375
break;
380376
}
@@ -384,7 +380,7 @@ namespace ren {
384380
// component, this is not an error.
385381
if (it->first > id)
386382
{
387-
std::cerr << "runGCAgainstVaidIDs: validKeys contains elements not in the FBO map." << std::endl;
383+
std::cerr << "runGCAgainstValidIDs: validKeys contains elements not in the FBO map." << std::endl;
388384
}
389385

390386
// Increment passed current validKey id.
@@ -414,8 +410,9 @@ namespace ren {
414410
void postWalkComponents(spire::ESCoreBase& core) override
415411
{
416412
std::weak_ptr<FBOMan> im = core.getStaticComponent<StaticFBOMan>()->instance_;
417-
if (std::shared_ptr<FBOMan> man = im.lock()) {
418-
man->runGCAgainstVaidIDs(mValidKeys);
413+
if (std::shared_ptr<FBOMan> man = im.lock())
414+
{
415+
man->runGCAgainstValidIDs(mValidKeys);
419416
mValidKeys.clear();
420417
}
421418
else

src/Externals/spire/es-render/FBOMan.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ namespace ren {
143143

144144
/// Runs garbage collection against a set of valid keys. All OpenGL ids not
145145
/// in validKeys will be removed from the system.
146-
void runGCAgainstVaidIDs(const std::set<GLuint>& validKeys);
146+
void runGCAgainstValidIDs(const std::set<GLuint>& validKeys);
147147

148148
std::map<GLuint, FBOData> mFBOData;
149149
/// Map from asset name to GL id.

src/Interface/Modules/Render/ES/RendererInterface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ namespace SCIRun
8181
virtual void setMouseMode(MouseMode mode) = 0;
8282
virtual void eventResize(size_t width, size_t height) = 0;
8383
virtual void doFrame(double constantDeltaTime) = 0;
84+
virtual void cleanupSelect() = 0;
8485
};
8586

8687
class SCISHARE RendererModuleInterface

0 commit comments

Comments
 (0)