[ekiga/gnome-2-26] Modified the frame buffer memory management in the X window
- From: Eugen Dedu <ededu src gnome org>
- To: svn-commits-list gnome org
- Subject: [ekiga/gnome-2-26] Modified the frame buffer memory management in the X window
- Date: Mon, 27 Apr 2009 12:35:38 -0400 (EDT)
commit d4626d385ff8db2385dd57506a845cf0d06a1db9
Author: Julien Puydt <jpuydt noether localdomain>
Date: Thu Apr 23 14:17:08 2009 +0200
Modified the frame buffer memory management in the X window
Let's try to use a smart pointer... that may fix bug #578642
---
lib/gui/xwindow.cpp | 10 +++-------
lib/gui/xwindow.h | 4 +++-
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/lib/gui/xwindow.cpp b/lib/gui/xwindow.cpp
index 4e9dc8e..d58bad0 100644
--- a/lib/gui/xwindow.cpp
+++ b/lib/gui/xwindow.cpp
@@ -125,7 +125,6 @@ XWindow::XWindow()
snprintf (_colorFormat, sizeof(_colorFormat), "NONE");
_planes = 0;
_colorConverter = NULL;
- _frameBuffer = NULL;
#ifdef HAVE_SHM
_XShmInfo.shmaddr = NULL;
@@ -175,9 +174,6 @@ XWindow::~XWindow()
if (_colorConverter)
delete (_colorConverter);
-
- if (_frameBuffer)
- free (_frameBuffer);
}
@@ -274,7 +270,7 @@ XWindow::Init (Display* dp,
if (!_colorConverter)
return 0;
- _frameBuffer = (uint8_t*) malloc (_imageWidth * _imageHeight * _planes);
+ _frameBuffer = std::tr1::shared_ptr<void> (malloc (_imageWidth * _imageHeight * _planes), free);
// detect the window manager type
_wmType = GetWMType ();
@@ -303,7 +299,7 @@ XWindow::PutFrame (uint8_t* frame,
if ((_state.curWidth != _XImage->width) || (_state.curHeight!=_XImage->height))
CreateXImage(_state.curWidth, _state.curHeight);
- _colorConverter->Convert((BYTE*)frame, (BYTE*)_frameBuffer);
+ _colorConverter->Convert((BYTE*)frame, (BYTE*)_frameBuffer.get ());
pixops_scale ((guchar*) _XImage->data,
0,0,
@@ -312,7 +308,7 @@ XWindow::PutFrame (uint8_t* frame,
_planes, //dest_channels,
FALSE, //dest_has_alpha,
- (const guchar*) _frameBuffer,
+ (const guchar*) _frameBuffer.get (),
width,
height,
width * _planes, //src_rowstride
diff --git a/lib/gui/xwindow.h b/lib/gui/xwindow.h
index c8cad10..325c6d3 100644
--- a/lib/gui/xwindow.h
+++ b/lib/gui/xwindow.h
@@ -39,6 +39,8 @@
#include <stdint.h>
#include "config.h"
+#include <tr1/memory>
+
#include <ptlib.h>
#include <ptlib/vconvert.h>
@@ -243,7 +245,7 @@ private:
int _planes;
PColourConverter* _colorConverter;
- uint8_t* _frameBuffer;
+ std::tr1::shared_ptr<void> _frameBuffer;
#ifdef HAVE_SHM
XShmSegmentInfo _XShmInfo;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]