Comment 0 for bug 890589

Revision history for this message
Robert Nordan (rpvn) wrote :

Sometimes when you click the text tool for the first time an exception will be raised and caught with this text (in debug mode):

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at Pinta.Core.FontManager.GetSizes (Pango.FontFace fontFace) [0x00024] in /home/rpvn/vcs/Pinta/Pinta.Core/Managers/FontManager.cs:81
  at Pinta.Core.FontManager.GetSizes (Pango.FontFamily family) [0x00000] in /home/rpvn/vcs/Pinta/Pinta.Core/Managers/FontManager.cs:64
  at Pinta.Tools.TextTool.UpdateFontSizes () [0x0002d] in /home/rpvn/vcs/Pinta/Pinta.Tools/Tools/TextTool/TextTool.cs:252
  at Pinta.Tools.TextTool.OnBuildToolBar (Gtk.Toolbar tb) [0x00652] in /home/rpvn/vcs/Pinta/Pinta.Tools/Tools/TextTool/TextTool.cs:209
  at Pinta.Core.BaseTool.DoBuildToolBar (Gtk.Toolbar tb) [0x00000] in /home/rpvn/vcs/Pinta/Pinta.Core/Classes/BaseTool.cs:95
  at Pinta.Core.ToolManager.SetCurrentTool (Pinta.Core.BaseTool tool) [0x0009d] in /home/rpvn/vcs/Pinta/Pinta.Core/Managers/ToolManager.cs:124
  at Pinta.Core.ToolManager.HandlePbToolItemClicked (System.Object sender, System.EventArgs e) [0x00053] in /home/rpvn/vcs/Pinta/Pinta.Core/Managers/ToolManager.cs:75
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod*,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d5] in /usr/src/packages/BUILD/mono-2.8.2/mcs/class/corlib/System.Reflection/MonoMethod.cs:223
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000f0] in /usr/src/packages/BUILD/mono-2.8.2/mcs/class/corlib/System.Reflection/MonoMethod.cs:231
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /usr/src/packages/BUILD/mono-2.8.2/mcs/class/corlib/System.Reflection/MethodBase.cs:96
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000bf] in /usr/src/packages/BUILD/mono-2.8.2/mcs/class/corlib/System/Delegate.cs:401
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /usr/src/packages/BUILD/mono-2.8.2/mcs/class/corlib/System/MulticastDelegate.cs:69
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /usr/src/packages/BUILD/mono-2.8.2/mcs/class/corlib/System/Delegate.cs:375
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x0004f] in /usr/src/packages/BUILD/gtk-sharp-2.12.10/glib/Signal.cs:195
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x0000c] in /usr/src/packages/BUILD/gtk-sharp-2.12.10/glib/SignalClosure.cs:118
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00075] in /usr/src/packages/BUILD/gtk-sharp-2.12.10/glib/SignalClosure.cs:146

This would appear to be because the fonts aren't finished initializing or something similar. After closing the exception window you can type text but not change font size. The fix is probably to catch the exception earlier and subsitute the default font size.