Preventive fixes for some unlikely memory issues

This commit is contained in:
rdb 2010-06-04 08:05:49 +00:00
parent cd3dfe6911
commit 80dba4efd6
3 changed files with 8 additions and 2 deletions

View File

@ -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;

View File

@ -58,7 +58,7 @@
#include <limits.h>
#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);

View File

@ -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);