fix crash

This commit is contained in:
David Rose 2008-07-23 21:57:39 +00:00
parent 227ed2dc45
commit 63f0e86da0
2 changed files with 9 additions and 6 deletions

View File

@ -97,7 +97,7 @@ do_zlib_free(voidpf opaque, voidpf address) {
////////////////////////////////////////////////////////////////////
// Function: VertexDataPage::Book Constructor
// Access: Public
// Access: Private
// Description: This constructor is used only by VertexDataBook, to
// create a mostly-empty object that can be used to
// search for a particular page size in the set.
@ -119,7 +119,7 @@ VertexDataPage(size_t book_size) :
////////////////////////////////////////////////////////////////////
// Function: VertexDataPage::Constructor
// Access: Public
// Access: Private
// Description:
////////////////////////////////////////////////////////////////////
VertexDataPage::
@ -141,7 +141,7 @@ VertexDataPage(VertexDataBook *book, size_t page_size, size_t block_size) :
////////////////////////////////////////////////////////////////////
// Function: VertexDataPage::Destructor
// Access: Public
// Access: Private, Virtual
// Description:
////////////////////////////////////////////////////////////////////
VertexDataPage::
@ -163,6 +163,8 @@ VertexDataPage::
free_page_data(_page_data, _allocated_size);
_size = 0;
}
nassertv(_book == NULL);
}
////////////////////////////////////////////////////////////////////
@ -240,6 +242,7 @@ changed_contiguous() {
VertexDataBook::Pages::iterator pi = _book->_pages.find(this);
nassertv(pi != _book->_pages.end());
_book->_pages.erase(pi);
_book = NULL;
delete this;
return;
}
@ -692,7 +695,7 @@ adjust_book_size() {
new_size = 0;
}
if (new_size != _book_size) {
if (_book != (VertexDataBook *)NULL && new_size != _book_size) {
VertexDataBook::Pages::iterator pi = _book->_pages.find(this);
nassertv(pi != _book->_pages.end());
_book->_pages.erase(pi);

View File

@ -38,10 +38,10 @@ class VertexDataBlock;
// cache file, if necessary.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_GOBJ VertexDataPage : public SimpleAllocator, public SimpleLruPage {
public:
private:
VertexDataPage(size_t book_size);
VertexDataPage(VertexDataBook *book, size_t page_size, size_t block_size);
~VertexDataPage();
virtual ~VertexDataPage();
PUBLISHED:
// These are used to indicate the current residency state of the