Skip to content

Commit

Permalink
fix: Remove throw calls from destructors
Browse files Browse the repository at this point in the history
  • Loading branch information
9prady9 authored and umar456 committed Dec 29, 2017
1 parent 7ac34bc commit b57328d
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/api/cpp/chart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Chart::Chart(const Chart& pOther)

Chart::~Chart()
{
FG_THROW(fg_release_chart(get()));
fg_release_chart(get());
}

void Chart::setAxesTitles(const char* pX,
Expand Down
4 changes: 1 addition & 3 deletions src/api/cpp/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace forge
{

Font::Font()
{
fg_font temp = 0;
Expand All @@ -32,7 +31,7 @@ Font::Font(const Font& other)

Font::~Font()
{
FG_THROW(fg_release_font(get()));
fg_release_font(get());
}

void Font::loadFontFile(const char* const pFile)
Expand All @@ -49,5 +48,4 @@ fg_font Font::get() const
{
return mValue;
}

}
4 changes: 1 addition & 3 deletions src/api/cpp/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace forge
{

Histogram::Histogram(const unsigned pNBins, const dtype pDataType)
{
fg_histogram temp = 0;
Expand All @@ -39,7 +38,7 @@ Histogram::Histogram(const fg_histogram pHandle)

Histogram::~Histogram()
{
FG_THROW(fg_release_histogram(get()));
fg_release_histogram(get());
}

void Histogram::setColor(const Color pColor)
Expand Down Expand Up @@ -109,5 +108,4 @@ fg_histogram Histogram::get() const
{
return mValue;
}

}
4 changes: 1 addition & 3 deletions src/api/cpp/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

namespace forge
{

Image::Image(const unsigned pWidth, const unsigned pHeight,
const ChannelFormat pFormat, const dtype pDataType)
: mValue(0)
Expand All @@ -43,7 +42,7 @@ Image::Image(const fg_image pHandle)

Image::~Image()
{
FG_THROW(fg_release_image(get()));
fg_release_image(get());
}

void Image::setAlpha(const float pAlpha)
Expand Down Expand Up @@ -109,5 +108,4 @@ fg_image Image::get() const
{
return mValue;
}

}
4 changes: 1 addition & 3 deletions src/api/cpp/plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace forge
{

Plot::Plot(const unsigned pNumPoints, const dtype pDataType, const ChartType pChartType,
const PlotType pPlotType, const MarkerType pMarkerType)
{
Expand All @@ -41,7 +40,7 @@ Plot::Plot(const fg_plot pHandle)

Plot::~Plot()
{
FG_THROW(fg_release_plot(get()));
fg_release_plot(get());
}

void Plot::setColor(const Color pColor)
Expand Down Expand Up @@ -130,5 +129,4 @@ fg_plot Plot::get() const
{
return mValue;
}

}
4 changes: 1 addition & 3 deletions src/api/cpp/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace forge
{

Surface::Surface(unsigned pNumXPoints, unsigned pNumYPoints, dtype pDataType, PlotType pPlotType, MarkerType pMarkerType)
{
fg_surface temp = 0;
Expand All @@ -40,7 +39,7 @@ Surface::Surface(const fg_surface pHandle)

Surface::~Surface()
{
FG_THROW(fg_release_surface(get()));
fg_release_surface(get());
}

void Surface::setColor(const Color pColor)
Expand Down Expand Up @@ -110,5 +109,4 @@ fg_surface Surface::get() const
{
return mValue;
}

}
4 changes: 1 addition & 3 deletions src/api/cpp/vector_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace forge
{

VectorField::VectorField(const unsigned pNumPoints, const dtype pDataType, const ChartType pChartType)
{
fg_vector_field temp = 0;
Expand All @@ -39,7 +38,7 @@ VectorField::VectorField(const fg_vector_field pHandle)

VectorField::~VectorField()
{
FG_THROW(fg_release_vector_field(get()));
fg_release_vector_field(get());
}

void VectorField::setColor(const Color pColor)
Expand Down Expand Up @@ -123,5 +122,4 @@ fg_vector_field VectorField::get() const
{
return mValue;
}

}
4 changes: 1 addition & 3 deletions src/api/cpp/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace forge
{

Window::Window(const int pWidth, const int pHeight, const char* pTitle,
const Window* pWindow, const bool invisible)
: mValue(0)
Expand All @@ -38,7 +37,7 @@ Window::Window(const Window& other)

Window::~Window()
{
FG_THROW(fg_release_window(get()));
fg_release_window(get());
}

void Window::setFont(Font* pFont)
Expand Down Expand Up @@ -152,5 +151,4 @@ void Window::saveFrameBuffer(const char* pFullPath)
{
FG_THROW(fg_save_window_framebuffer(pFullPath, get()));
}

}
2 changes: 0 additions & 2 deletions src/backend/opengl/chart_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,11 @@ AbstractChart::AbstractChart(const float pLeftMargin, const float pRightMargin,

AbstractChart::~AbstractChart()
{
CheckGL("Begin AbstractChart::~AbstractChart");
for (auto it = mVAOMap.begin(); it!=mVAOMap.end(); ++it) {
GLuint vao = it->second;
glDeleteVertexArrays(1, &vao);
}
glDeleteBuffers(1, &mDecorVBO);
CheckGL("End AbstractChart::~AbstractChart");
}

void AbstractChart::setAxesLimits(const float pXmin, const float pXmax,
Expand Down
2 changes: 0 additions & 2 deletions src/backend/opengl/histogram_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,10 @@ histogram_impl::histogram_impl(const uint pNBins, const forge::dtype pDataType)

histogram_impl::~histogram_impl()
{
CheckGL("Begin histogram_impl::~histogram_impl");
for (auto it = mVAOMap.begin(); it!=mVAOMap.end(); ++it) {
GLuint vao = it->second;
glDeleteVertexArrays(1, &vao);
}
CheckGL("End histogram_impl::~histogram_impl");
}

void histogram_impl::render(const int pWindowId,
Expand Down
2 changes: 0 additions & 2 deletions src/backend/opengl/image_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ image_impl::image_impl(const uint pWidth, const uint pHeight,

image_impl::~image_impl()
{
CheckGL("Begin image_impl::~image_impl");
glDeleteBuffers(1, &mPBO);
glDeleteTextures(1, &mTex);
CheckGL("End image_impl::~image_impl");
}

void image_impl::setColorMapUBOParams(const GLuint pUBO, const GLuint pSize)
Expand Down
2 changes: 0 additions & 2 deletions src/backend/opengl/plot_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,11 @@ plot_impl::plot_impl(const uint pNumPoints, const forge::dtype pDataType,

plot_impl::~plot_impl()
{
CheckGL("Begin plot_impl::~plot_impl");
for (auto it = mVAOMap.begin(); it!=mVAOMap.end(); ++it) {
GLuint vao = it->second;
glDeleteVertexArrays(1, &vao);
}
glDeleteBuffers(1, &mRBO);
CheckGL("End plot_impl::~plot_impl");
}

void plot_impl::setMarkerSize(const float pMarkerSize)
Expand Down
2 changes: 0 additions & 2 deletions src/backend/opengl/surface_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,11 @@ surface_impl::surface_impl(unsigned pNumXPoints, unsigned pNumYPoints,

surface_impl::~surface_impl()
{
CheckGL("Begin Plot::~Plot");
for (auto it = mVAOMap.begin(); it!=mVAOMap.end(); ++it) {
GLuint vao = it->second;
glDeleteVertexArrays(1, &vao);
}
glDeleteBuffers(1, &mIBO);
CheckGL("End Plot::~Plot");
}

void surface_impl::render(const int pWindowId,
Expand Down
2 changes: 0 additions & 2 deletions src/backend/opengl/vector_field_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,11 @@ vector_field_impl::vector_field_impl(const uint pNumPoints, const forge::dtype p

vector_field_impl::~vector_field_impl()
{
CheckGL("Begin vector_field_impl::~vector_field_impl");
for (auto it = mVAOMap.begin(); it!=mVAOMap.end(); ++it) {
GLuint vao = it->second;
glDeleteVertexArrays(1, &vao);
}
glDeleteBuffers(1, &mDBO);
CheckGL("End vector_field_impl::~vector_field_impl");
}

GLuint vector_field_impl::directions()
Expand Down

0 comments on commit b57328d

Please sign in to comment.