GNOME Bugzilla – Bug 541102
Switching to Mini Mode when a track is paused leads to a crash
Last modified: 2008-07-25 20:46:34 UTC
Steps to reproduce: 1. Start banshee 2. Play a track 3. Pause the track 4. Click on View > MiniMode Stack trace: Object reference not set to an instance of an object System.NullReferenceException: Object reference not set to an instance of an object at Banshee.Widgets.StreamPositionLabel.UpdateLabel (System.String text) [0x00000] in /home/lorentz/Projets/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs:150 at Banshee.Widgets.StreamPositionLabel.UpdateLabel () [0x000db] in /home/lorentz/Projets/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs:143 at Banshee.Widgets.StreamPositionLabel.OnSliderUpdated (System.Object o, System.EventArgs args) [0x00000] in /home/lorentz/Projets/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs:165 at GLib.Signal.voidObjectCallback (IntPtr handle, IntPtr gch) [0x00000] at (wrapper native-to-managed) GLib.Signal:voidObjectCallback (intptr,intptr) at (wrapper managed-to-native) Gtk.Range:gtk_range_set_value (intptr,double) at Gtk.Range.set_Value (Double value) [0x00000] at Banshee.Widgets.SeekSlider.set_SeekValue (Int64 value) [0x00028] in /home/lorentz/Projets/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/SeekSlider.cs:113 at Banshee.Gui.Widgets.ConnectedSeekSlider.OnPlayerEngineTick () [0x00050] in /home/lorentz/Projets/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs:179 at Banshee.Gui.Widgets.ConnectedSeekSlider..ctor (SeekSliderLayout layout) [0x00086] in /home/lorentz/Projets/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs:72 at Banshee.Gui.Widgets.ConnectedSeekSlider..ctor () [0x00000] in /home/lorentz/Projets/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ConnectedSeekSlider.cs:48 at Banshee.MiniMode.MiniMode.Initialize () [0x0017e] in /home/lorentz/Projets/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs:106 <snip> Other information: It seems that the pango layout is instantiated after the StreamPositionLabel is realized, but OnSliderUpdated is triggered before that, causing the crash. This is probably triggered by the change made for bug #536564. I'll post a patch that fixes the crash
Created attachment 113788 [details] [review] Fix the crash by moving the BuildLayout call to the constructor As I don't know anything about Pango, I don't know if it's the right way to do things, but it fixes the problem for me.
Created attachment 115272 [details] [review] Fix the crash, fix a style issue Hi Bertrand. Your patch works, but it's more correct to create the layout only when the widget becomes realized. My fix just adds a few tests in UpdateLayout to ensure the widget has been realized and the layout available. I found some extra unrelated issue when testing as well. The layout was never rebuilt when font size is changed. This patch also addresses that. Thanks!