# HG changeset patch # User Alain Mazy # Date 1579011730 -3600 # Node ID 9c20ae049669d6fe4fe6f8f37f6542cc8de47b8b # Parent 6af941a68472880f8c8f5085255c305e80ee4822 more logs to debug exceptions in Render diff -r 6af941a68472 -r 9c20ae049669 Framework/Radiography/RadiographyScene.cpp --- a/Framework/Radiography/RadiographyScene.cpp Tue Jan 14 12:05:01 2020 +0100 +++ b/Framework/Radiography/RadiographyScene.cpp Tue Jan 14 15:22:10 2020 +0100 @@ -564,11 +564,24 @@ // Render layers in the background-to-foreground order for (size_t index = 0; index < nextLayerIndex_; index++) { - Layers::const_iterator it = layers_.find(index); - if (it != layers_.end()) + try { - assert(it->second != NULL); - it->second->Render(buffer, viewTransform, interpolation, windowingCenter_, windowingWidth_, applyWindowing); + Layers::const_iterator it = layers_.find(index); + if (it != layers_.end()) + { + assert(it->second != NULL); + it->second->Render(buffer, viewTransform, interpolation, windowingCenter_, windowingWidth_, applyWindowing); + } + } + catch (Orthanc::OrthancException& ex) + { + LOG(ERROR) << "RadiographyScene::Render: " << index << ", OrthancException: " << ex.GetDetails(); + throw ex; // rethrow because we want it to crash to see there's a problem ! + } + catch (...) + { + LOG(ERROR) << "RadiographyScene::Render: " << index << ", unkown exception: "; + throw; // rethrow because we want it to crash to see there's a problem ! } } } diff -r 6af941a68472 -r 9c20ae049669 Framework/Radiography/RadiographyWidget.cpp --- a/Framework/Radiography/RadiographyWidget.cpp Tue Jan 14 12:05:01 2020 +0100 +++ b/Framework/Radiography/RadiographyWidget.cpp Tue Jan 14 15:22:10 2020 +0100 @@ -76,6 +76,11 @@ { floatBuffer_.reset(new Orthanc::Image( Orthanc::PixelFormat_Float32, width, height, false)); + + if (floatBuffer_.get() == NULL) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory, "RadiographyWidget::RenderInternal: unable to allocate float buffer"); + } } if (cairoBuffer_.get() == NULL || @@ -83,6 +88,11 @@ cairoBuffer_->GetHeight() != height) { cairoBuffer_.reset(new CairoSurface(width, height, false /* no alpha */)); + + if (cairoBuffer_.get() == NULL) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory, "RadiographyWidget::RenderInternal: unable to allocate cairo buffer"); + } } RenderBackground(*floatBuffer_, 0.0, 65535.0);