diff --git a/pandatool/src/gtk-stats/gtkStatsFlameGraph.cxx b/pandatool/src/gtk-stats/gtkStatsFlameGraph.cxx index 08291038b8..dcd1491485 100644 --- a/pandatool/src/gtk-stats/gtkStatsFlameGraph.cxx +++ b/pandatool/src/gtk-stats/gtkStatsFlameGraph.cxx @@ -199,6 +199,9 @@ normal_guide_bars() { } _guide_bars_changed = true; + + nassertv_always(_scale_area != nullptr); + gtk_widget_queue_draw(_scale_area); } /** diff --git a/pandatool/src/gtk-stats/gtkStatsGraph.cxx b/pandatool/src/gtk-stats/gtkStatsGraph.cxx index f16fdd2287..5798a07833 100644 --- a/pandatool/src/gtk-stats/gtkStatsGraph.cxx +++ b/pandatool/src/gtk-stats/gtkStatsGraph.cxx @@ -33,11 +33,6 @@ GtkStatsGraph:: GtkStatsGraph(GtkStatsMonitor *monitor, bool has_label_stack) : _monitor(monitor) { - _parent_window = nullptr; - _window = nullptr; - _graph_window = nullptr; - _scale_area = nullptr; - GtkWidget *parent_window = monitor->get_window(); GdkWindow *window = gtk_widget_get_window(parent_window); diff --git a/pandatool/src/gtk-stats/gtkStatsGraph.h b/pandatool/src/gtk-stats/gtkStatsGraph.h index ca0a6b9954..bd2f333987 100644 --- a/pandatool/src/gtk-stats/gtkStatsGraph.h +++ b/pandatool/src/gtk-stats/gtkStatsGraph.h @@ -96,14 +96,14 @@ protected: TextColors _text_colors; GtkStatsMonitor *_monitor; - GtkWidget *_parent_window; - GtkWidget *_window; + GtkWidget *_parent_window = nullptr; + GtkWidget *_window = nullptr; GtkWidget *_graph_frame; - GtkWidget *_graph_window; + GtkWidget *_graph_window = nullptr; GtkWidget *_graph_hbox; GtkWidget *_graph_vbox; GtkWidget *_hpaned; - GtkWidget *_scale_area; + GtkWidget *_scale_area = nullptr; GtkStatsLabelStack _label_stack; GdkCursor *_hand_cursor; diff --git a/pandatool/src/pstatserver/pStatFlameGraph.cxx b/pandatool/src/pstatserver/pStatFlameGraph.cxx index c57d257286..c383994e84 100644 --- a/pandatool/src/pstatserver/pStatFlameGraph.cxx +++ b/pandatool/src/pstatserver/pStatFlameGraph.cxx @@ -47,7 +47,6 @@ PStatFlameGraph(PStatMonitor *monitor, } _guide_bar_units = GBU_ms | GBU_hz | GBU_show_units; - normal_guide_bars(); monitor->_flame_graphs.insert(this); } @@ -213,8 +212,16 @@ read_datagram(DatagramIterator &scan) { PStatGraph::read_datagram(scan); _current_frame = -1; - normal_guide_bars(); + _stack.clear(); update(); + if (_average_mode) { + _time_width = _stack.get_net_value(false); + if (_time_width == 0.0) { + _time_width = 1.0 / pstats_target_frame_rate; + } + normal_guide_bars(); + force_redraw(); + } } /**