dont try free the widget's pixmap until it is no longer in use
Dana Jansens danakj@orodu.net
7 files changed,
16 insertions(+),
11 deletions(-)
M
otk/focuslabel.cc
→
otk/focuslabel.cc
@@ -67,7 +67,7 @@ }
} display->renderControl(_screen)-> - drawString(_surface, *ft, x, 0, *text_color, t); + drawString(*_surface, *ft, x, 0, *text_color, t); } }
M
otk/label.cc
→
otk/label.cc
@@ -61,7 +61,7 @@ }
} display->renderControl(_screen)-> - drawString(_surface, *ft, x, 0, *style()->getTextUnfocus(), t); + drawString(*_surface, *ft, x, 0, *style()->getTextUnfocus(), t); } }
M
otk/rendertest.cc
→
otk/rendertest.cc
@@ -13,7 +13,7 @@ otk::Application app(argc, argv);
otk::AppWidget foo(&app); foo.resize(600, 500); - otk::RenderColor color(0, 0xff, 0x20, 0x20); + otk::RenderColor color(0, 0, 0xff, 0xff); otk::RenderTexture tex(false, otk::RenderTexture::Flat, false,
M
otk/surface.cc
→
otk/surface.cc
@@ -39,7 +39,6 @@ }
void Surface::setPixmap(XImage *image) { - printf("SET PIXMAP\n"); assert(image->width == _size.x()); assert(image->height == _size.y());
M
otk/truerendercontrol.cc
→
otk/truerendercontrol.cc
@@ -132,5 +132,7 @@ // sf.setPixmap(RenderColor(_screen, 0xff, 0xff, 0));
delete [] im->data; im->data = NULL; - XDestroyImage(im);} + XDestroyImage(im); +} + }
M
otk/widget.cc
→
otk/widget.cc
@@ -25,7 +25,7 @@ _grabbed_keyboard(false), _stretchable_vert(false),
_stretchable_horz(false), _texture(0), _bg_pixmap(0), _bg_pixel(0), _bcolor(0), _bwidth(0), _rect(0, 0, 1, 1), _screen(parent->screen()), _fixed_width(false), _fixed_height(false), - _surface(parent->screen(), _rect.size()), + _surface(0), _event_dispatcher(parent->eventDispatcher()) { assert(parent);@@ -46,7 +46,7 @@ _grabbed_mouse(false), _grabbed_keyboard(false),
_stretchable_vert(false), _stretchable_horz(false), _texture(0), _bg_pixmap(0), _bg_pixel(0), _bcolor(0), _bwidth(0), _rect(0, 0, 1, 1), _screen(style->getScreen()), _fixed_width(false), _fixed_height(false), - _surface(style->getScreen(), _rect.size()), + _surface(0), _event_dispatcher(event_dispatcher) { assert(event_dispatcher);@@ -261,12 +261,16 @@ {
if (!_texture) return; printf("RENDER\n"); - _surface = Surface(_screen, _rect.size()); - display->renderControl(_screen)->drawBackground(_surface, *_texture); + Surface *s = _surface; // save the current surface + + _surface = new Surface(_screen, _rect.size()); + display->renderControl(_screen)->drawBackground(*_surface, *_texture); renderForeground(); - XSetWindowBackgroundPixmap(**display, _window, _surface.pixmap()); + XSetWindowBackgroundPixmap(**display, _window, _surface->pixmap()); + + delete s; // delete the old surface *after* its pixmap isn't in use anymore } void Widget::adjust(void)
M
otk/widget.hh
→
otk/widget.hh
@@ -167,7 +167,7 @@
bool _fixed_width; bool _fixed_height; - Surface _surface; + Surface *_surface; EventDispatcher *_event_dispatcher; };