From 7450ffd910b324998db6035ef60043f7b591532f Mon Sep 17 00:00:00 2001 From: "Eric J. Korpela" Date: Fri, 11 Feb 2005 02:15:20 +0000 Subject: [PATCH] There was a problem using dynamic allocations (with new) in many of the graphics classes. In many places the code was written assuming default values of 0, especially for pointers and booleans. While that's true in the case of a static instance with the default constructors, it not generally true with dynamic allocation unless the default constructor is replaced. Therefore I've added constructors in the following classes/structs: MOVING_TEXT_PANEL, COLOR, PROGRESS, PROGRESS_2D, TEXTURE_DESC, REDUCED_ARRAY. This will be a problem is any are used from C code unless the constructors declarations are enclosed in "#ifdef __cplusplus" blocks. There was also a problem that showed up under Windows when dynamic allocations were used. app_graphics_resize() gets called before app_graphics_init(). This usually results in a crash since classes haven't yet been constructed. To work around this I've added a case for WM_CREATE in the WndProc() which calls app_graphics_init. Under windows this will get passed before WM_SIZE does. svn path=/trunk/boinc/; revision=5395 --- api/gutil.C | 13 +++++++++++++ api/gutil.h | 13 +++++++++++++ api/reduce_main.C | 13 ++++++++----- api/windows_opengl.C | 3 +++ 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/api/gutil.C b/api/gutil.C index d63c7b7c56..b0be59bfa9 100755 --- a/api/gutil.C +++ b/api/gutil.C @@ -415,6 +415,19 @@ void draw_text_right( } } + +MOVING_TEXT_PANEL::MOVING_TEXT_PANEL() : + theta(0), dtheta(0), color(0), char_height(0), line_width(0), line_spacing(0), margin(0) +{ + int i; + for (i=0;i<3;i++) { + base_pos[i]=size[i]=0; + } + for (i=0;i