Joe Shochet 25 лет назад
Родитель
Сommit
2a018ab8e0
2 измененных файлов с 10 добавлено и 3 удалено
  1. 9 2
      panda/src/downloader/extractor.cxx
  2. 1 1
      panda/src/downloader/extractor.h

+ 9 - 2
panda/src/downloader/extractor.cxx

@@ -45,6 +45,7 @@ void Extractor::
 init(PT(Buffer) buffer) {
   nassertv(!buffer.is_null());
   _buffer = buffer;
+  _mfile = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -54,6 +55,8 @@ init(PT(Buffer) buffer) {
 ////////////////////////////////////////////////////////////////////
 Extractor::
 ~Extractor(void) {
+  if (_mfile != NULL)
+    delete _mfile;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -84,7 +87,10 @@ initiate(Filename &source_file, const Filename &rel_path) {
   _total_bytes_read = 0;
   _read_all_input = false;
   _handled_all_input = false;
-  _mfile.reset();
+  //_mfile.reset();
+  if (_mfile != NULL)
+    delete _mfile;
+  _mfile = new Multifile;
   return ES_success;
 }
 
@@ -109,9 +115,10 @@ run(void) {
   // Write to the out file
   char *start = _buffer->_buffer;
   int size = _source_buffer_length; 
-  if (_mfile.write(start, size, _rel_path) == true) {
+  if (_mfile->write(start, size, _rel_path) == true) {
     _read_stream.close();
     _source_file.unlink();
+    delete _mfile;
     return ES_success;
   }
   return ES_ok;

+ 1 - 1
panda/src/downloader/extractor.h

@@ -44,7 +44,7 @@ private:
 
   ifstream _read_stream;
   int _source_file_length;
-  Multifile _mfile;
+  Multifile *_mfile;
   int _total_bytes_read;
   bool _read_all_input;
   bool _handled_all_input;