Actually destroy duplicated PHYSFS_Io instance on close
Fixes crash after loading about a hundred maps
This commit is contained in:
parent
958af38442
commit
41675859dd
|
@ -48,17 +48,18 @@ struct RGSS_entryHandle
|
||||||
uint64_t currentOffset;
|
uint64_t currentOffset;
|
||||||
PHYSFS_Io *io;
|
PHYSFS_Io *io;
|
||||||
|
|
||||||
RGSS_entryHandle(const RGSS_entryData &data)
|
RGSS_entryHandle(const RGSS_entryData &data, PHYSFS_Io *archIo)
|
||||||
: data(data),
|
: data(data),
|
||||||
currentMagic(data.startMagic),
|
currentMagic(data.startMagic),
|
||||||
currentOffset(0)
|
currentOffset(0)
|
||||||
{}
|
{
|
||||||
|
io = archIo->duplicate(archIo);
|
||||||
|
}
|
||||||
|
|
||||||
RGSS_entryHandle(const RGSS_entryHandle &other)
|
~RGSS_entryHandle()
|
||||||
: data(other.data),
|
{
|
||||||
currentMagic(other.currentMagic),
|
io->destroy(io);
|
||||||
currentOffset(other.currentOffset)
|
}
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList<QByteArray> QByteList;
|
typedef QList<QByteArray> QByteList;
|
||||||
|
@ -436,8 +437,8 @@ RGSS_openRead(void *opaque, const char *filename)
|
||||||
if (!data->entryHash.contains(filename))
|
if (!data->entryHash.contains(filename))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
RGSS_entryHandle *entry = new RGSS_entryHandle(data->entryHash[filename]);
|
RGSS_entryHandle *entry =
|
||||||
entry->io = data->archiveIo->duplicate(data->archiveIo);
|
new RGSS_entryHandle(data->entryHash[filename], data->archiveIo);
|
||||||
|
|
||||||
PHYSFS_Io *io = PHYSFS_ALLOC(PHYSFS_Io);
|
PHYSFS_Io *io = PHYSFS_ALLOC(PHYSFS_Io);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue