diff Framework/Radiography/RadiographyWidget.cpp @ 1279:7ec8fea061b9 broker

integration mainline->broker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Feb 2020 15:20:08 +0100
parents 0ca50d275b9a 2d8ab34c8c91
children
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyWidget.cpp	Fri Jan 31 17:34:57 2020 +0100
+++ b/Framework/Radiography/RadiographyWidget.cpp	Tue Feb 04 15:20:08 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);
@@ -188,6 +198,8 @@
   void RadiographyWidget::Unselect()
   {
     hasSelection_ = false;
+
+    NotifyContentChanged();
     BroadcastMessage(SelectionChangedMessage(*this));
   }