[chronojump] Fixed bars not showing and crash at capture on config.EncoderCaptureShowOnlyBars == TRUE



commit 76747583aa91eddf0d662fcbfc3d75b41015d2ce
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Oct 9 19:49:43 2016 +0200

    Fixed bars not showing and crash at capture on config.EncoderCaptureShowOnlyBars == TRUE

 src/gui/encoder.cs  |   34 ++++++++++++++++++++--------------
 src/gui/networks.cs |    4 +++-
 2 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 9603f2b..f641ca2 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -3931,6 +3931,10 @@ public partial class ChronoJumpWindow
                if(eCapture.EncoderCapturePoints == null)
                        return;
 
+               //this happens when EncoderCaptureShowOnlyBars=TRUE
+               if(encoder_capture_signal_drawingarea == null || encoder_capture_signal_pixmap == null)
+                       return;
+
                bool refreshAreaOnly = false;
                
                //mark meaning screen should be erased
@@ -4723,20 +4727,22 @@ public partial class ChronoJumpWindow
                layout_encoder_capture_curves_bars_text = new Pango.Layout 
(encoder_capture_curves_bars_drawingarea.PangoContext);
                layout_encoder_capture_curves_bars_text.FontDescription = Pango.FontDescription.FromString 
("Courier 10");
 
-               pen_black_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_gray = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_red_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_red_dark_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_red_light_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_green_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_green_dark_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_green_light_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_blue_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_blue_dark_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_blue_light_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_white_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               pen_selected_encoder_capture = new Gdk.GC(encoder_capture_signal_drawingarea.GdkWindow);
-               
+               //defined as encoder_capture_curves_bars_drawingarea instead of 
encoder_capture_signal_drawingarea
+               //because the 2nd is null if config.EncoderCaptureShowOnlyBars == TRUE
+               pen_black_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_gray = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_red_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_red_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_green_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_blue_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_white_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_selected_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_red_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_red_dark_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_green_light_encoder_capture = new 
Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_green_dark_encoder_capture = new 
Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_blue_dark_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
+               pen_blue_light_encoder_capture = new 
Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
                pen_yellow_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
 
                Gdk.Colormap colormap = Gdk.Colormap.System;
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index bb75269..d730860 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -134,7 +134,9 @@ public partial class ChronoJumpWindow
                else if(config.OnlyEncoderInertial)
                        select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERINERTIAL);
                
-               if(config.EncoderCaptureShowOnlyBars) {
+               if(config.EncoderCaptureShowOnlyBars)
+               {
+                       //attention: this makes encoder_capture_signal_drawingarea == null
                        vpaned_encoder_capture_video_and_set_graph.Visible = false;
                        
                        vpaned_encoder_main.Remove(alignment_treeview_encoder_capture_curves);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]