Make sure GlxRenderer frees its resources.

BUG=
R=mflodman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1544004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4098 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2013-05-24 10:54:56 +00:00
parent c74c3c2447
commit 28556f5658
2 changed files with 3 additions and 11 deletions

View File

@ -21,8 +21,7 @@ namespace webrtc {
namespace test {
GlxRenderer::GlxRenderer(size_t width, size_t height)
: is_init_(false),
width_(width),
: width_(width),
height_(height),
display_(NULL),
context_(NULL) {
@ -30,6 +29,8 @@ GlxRenderer::GlxRenderer(size_t width, size_t height)
assert(height > 0);
}
GlxRenderer::~GlxRenderer() { Destroy(); }
bool GlxRenderer::Init(const char* window_title) {
if ((display_ = XOpenDisplay(NULL)) == NULL) {
Destroy();
@ -90,12 +91,6 @@ bool GlxRenderer::Init(const char* window_title) {
}
void GlxRenderer::Destroy() {
if (!is_init_) {
return;
}
is_init_ = false;
if (context_ != NULL) {
glXMakeCurrent(display_, window_, context_);
GlRenderer::Destroy();
@ -121,8 +116,6 @@ GlxRenderer* GlxRenderer::Create(const char* window_title, size_t width,
return glx_renderer;
}
GlxRenderer::~GlxRenderer() { Destroy(); }
void GlxRenderer::Resize(size_t width, size_t height) {
width_ = width;
height_ = height;

View File

@ -34,7 +34,6 @@ class GlxRenderer : public GlRenderer {
void Resize(size_t width, size_t height);
void Destroy();
bool is_init_;
size_t width_, height_;
Display* display_;