mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 23:34:57 -04:00
pstats: Fix menus not updating in some conditions
Menus would only update properly if there was a strip chart open that would cause the PStatView to be updated Calling `check_update()` in `new_collector()` doesn't work properly because the views haven't been updated there yet; calling `do_update()` there does work around it but I think the better fix is just to make sure we always update the view so that the `check_update()` (which is also called by `idle()`) works properly
This commit is contained in:
parent
73360393df
commit
a9f6e6fd8a
@ -160,11 +160,6 @@ new_collector(int collector_index) {
|
||||
for (GtkStatsGraph *graph : _graphs) {
|
||||
graph->new_collector(collector_index);
|
||||
}
|
||||
|
||||
// We might need to update our menus.
|
||||
for (GtkStatsChartMenu *chart_menu : _chart_menus) {
|
||||
chart_menu->check_update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,6 +185,8 @@ new_thread(int thread_index) {
|
||||
*/
|
||||
void GtkStatsMonitor::
|
||||
new_data(int thread_index, int frame_number) {
|
||||
PStatMonitor::new_data(thread_index, frame_number);
|
||||
|
||||
for (GtkStatsGraph *graph : _graphs) {
|
||||
graph->new_data(thread_index, frame_number);
|
||||
}
|
||||
|
@ -174,11 +174,6 @@ new_collector(int collector_index) {
|
||||
for (MacStatsGraph *graph : _graphs) {
|
||||
graph->new_collector(collector_index);
|
||||
}
|
||||
|
||||
// We might need to update our menus.
|
||||
for (MacStatsChartMenu *chart_menu : _chart_menus) {
|
||||
chart_menu->check_update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -204,6 +199,8 @@ new_thread(int thread_index) {
|
||||
*/
|
||||
void MacStatsMonitor::
|
||||
new_data(int thread_index, int frame_number) {
|
||||
PStatMonitor::new_data(thread_index, frame_number);
|
||||
|
||||
for (MacStatsGraph *graph : _graphs) {
|
||||
graph->new_data(thread_index, frame_number);
|
||||
}
|
||||
|
@ -563,7 +563,22 @@ new_thread(int) {
|
||||
* data will facilitate this.
|
||||
*/
|
||||
void PStatMonitor::
|
||||
new_data(int, int) {
|
||||
new_data(int thread_index, int frame_number) {
|
||||
const PStatClientData *client_data = get_client_data();
|
||||
|
||||
// Don't bother to update the thread data until we know at least something
|
||||
// about the collectors and threads.
|
||||
if (client_data->get_num_collectors() != 0 &&
|
||||
client_data->get_num_threads() != 0) {
|
||||
PStatView &view = get_view(thread_index);
|
||||
const PStatThreadData *thread_data = view.get_thread_data();
|
||||
if (!thread_data->is_empty()) {
|
||||
int latest = thread_data->get_latest_frame_number();
|
||||
if (frame_number == latest) {
|
||||
view.set_to_frame(thread_data->get_frame(frame_number));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,11 +146,6 @@ new_collector(int collector_index) {
|
||||
for (WinStatsGraph *graph : _graphs) {
|
||||
graph->new_collector(collector_index);
|
||||
}
|
||||
|
||||
// We might need to update our menus.
|
||||
for (WinStatsChartMenu *chart_menu : _chart_menus) {
|
||||
chart_menu->do_update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,6 +191,8 @@ remove_thread(int thread_index) {
|
||||
*/
|
||||
void WinStatsMonitor::
|
||||
new_data(int thread_index, int frame_number) {
|
||||
PStatMonitor::new_data(thread_index, frame_number);
|
||||
|
||||
for (WinStatsGraph *graph : _graphs) {
|
||||
graph->new_data(thread_index, frame_number);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user