mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
pstats: Fix regression: crash when opening session file
This commit is contained in:
parent
a2890c03de
commit
2aa2a35a9f
@ -58,7 +58,7 @@ public:
|
|||||||
INLINE double get_level(size_t n) const;
|
INLINE double get_level(size_t n) const;
|
||||||
|
|
||||||
bool write_datagram(Datagram &destination, PStatClient *client = nullptr) const;
|
bool write_datagram(Datagram &destination, PStatClient *client = nullptr) const;
|
||||||
void read_datagram(DatagramIterator &source, PStatClientVersion *version = nullptr);
|
void read_datagram(DatagramIterator &source, PStatClientVersion *version);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class DataPoint {
|
class DataPoint {
|
||||||
|
@ -471,7 +471,7 @@ read_datagram(DatagramIterator &scan) {
|
|||||||
std::string name = scan.get_string();
|
std::string name = scan.get_string();
|
||||||
define_thread(thread_index, name);
|
define_thread(thread_index, name);
|
||||||
|
|
||||||
_threads[thread_index]._data->read_datagram(scan);
|
_threads[thread_index]._data->read_datagram(scan, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_toplevel_collectors();
|
update_toplevel_collectors();
|
||||||
|
@ -328,11 +328,11 @@ write_datagram(Datagram &dg) const {
|
|||||||
* Restores the thread data from a datagram.
|
* Restores the thread data from a datagram.
|
||||||
*/
|
*/
|
||||||
void PStatThreadData::
|
void PStatThreadData::
|
||||||
read_datagram(DatagramIterator &scan) {
|
read_datagram(DatagramIterator &scan, PStatClientVersion *version) {
|
||||||
int frame_number;
|
int frame_number;
|
||||||
while ((frame_number = scan.get_int32()) != -1) {
|
while ((frame_number = scan.get_int32()) != -1) {
|
||||||
PStatFrameData *frame_data = new PStatFrameData;
|
PStatFrameData *frame_data = new PStatFrameData;
|
||||||
frame_data->read_datagram(scan);
|
frame_data->read_datagram(scan, version);
|
||||||
|
|
||||||
record_new_frame(frame_number, frame_data);
|
record_new_frame(frame_number, frame_data);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
class PStatCollectorDef;
|
class PStatCollectorDef;
|
||||||
class PStatFrameData;
|
class PStatFrameData;
|
||||||
class PStatClientData;
|
class PStatClientData;
|
||||||
|
class PStatClientVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of FrameData structures for recently-received frames within a
|
* A collection of FrameData structures for recently-received frames within a
|
||||||
@ -63,7 +64,7 @@ public:
|
|||||||
void record_new_frame(int frame_number, PStatFrameData *frame_data);
|
void record_new_frame(int frame_number, PStatFrameData *frame_data);
|
||||||
|
|
||||||
void write_datagram(Datagram &dg) const;
|
void write_datagram(Datagram &dg) const;
|
||||||
void read_datagram(DatagramIterator &scan);
|
void read_datagram(DatagramIterator &scan, PStatClientVersion *version);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void compute_elapsed_frames() const;
|
void compute_elapsed_frames() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user