From 80dba4efd6aba31302dd1d83224b1bac031f5925 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 4 Jun 2010 08:05:49 +0000 Subject: [PATCH] Preventive fixes for some unlikely memory issues --- panda/src/display/displayInformation.cxx | 2 +- panda/src/display/graphicsStateGuardian.cxx | 4 +++- panda/src/gobj/texture.cxx | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/panda/src/display/displayInformation.cxx b/panda/src/display/displayInformation.cxx index b8e5ba3e91..0c3dc53ebe 100644 --- a/panda/src/display/displayInformation.cxx +++ b/panda/src/display/displayInformation.cxx @@ -23,7 +23,7 @@ DisplayInformation:: ~DisplayInformation() { if (_display_mode_array != NULL) { - delete _display_mode_array; + delete[] _display_mode_array; } if (_cpu_id_data != NULL) { delete _cpu_id_data; diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index f2f0a00fce..8c24244bbc 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -58,7 +58,7 @@ #include #ifdef HAVE_PYTHON -#include "py_panda.h" +#include "py_panda.h" #ifndef CPPPARSER IMPORT_THIS struct Dtool_PyTypedObject Dtool_Texture; #endif @@ -155,6 +155,7 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system, _prepared_objects = new PreparedGraphicsObjects; _stereo_buffer_mask = ~0; _incomplete_render = allow_incomplete_render; + _effective_incomplete_render = false; _loader = Loader::get_global_ptr(); _is_hardware = false; @@ -1748,6 +1749,7 @@ reset() { _lighting_enabled = false; _num_lights_enabled = 0; _num_clip_planes_enabled = 0; + _clip_planes_enabled = false; _color_scale_enabled = false; _current_color_scale.set(1.0f, 1.0f, 1.0f, 1.0f); diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index c47cf8f8a5..2f03737819 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -194,6 +194,10 @@ Texture(const string &name) : _x_size = 0; _y_size = 1; _z_size = 1; + // Set it to something else first to + // avoid the check in do_set_format + // depending on an uninitialised value + _format = F_rgba; do_set_format(F_rgb); do_set_component_type(T_unsigned_byte);