Crash when using Text tool

Bug #1190169 reported by grofaty
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Pinta
Fix Released
Medium
Cameron White

Bug Description

Pinta master on Windows XP:
1. New image 1000 x 1000.
2. Text tool from Tools pad.
3. Select 80 from font size drop-down list.
4. Click on canvas and type in some text like: test
5. Mark whole text with SHIFT+LEFT_KEY
6. Click somewhere else on canvas and crash appears.
===========
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Pinta.Core.TextEngine.ForeachLine(Int32 startLine, Int32 startPos, Int32 len, Action action) in c:\Zaloga\Pinta-master\Pinta.Core\Classes\Text\TextEngine.cs:line 623
   at Pinta.Core.TextEngine.get_SelectionRectangles() in c:\Zaloga\Pinta-master\Pinta.Core\Classes\Text\TextEngine.cs:line 89
   at Pinta.Tools.TextTool.RedrawText(Boolean showCursor, Boolean useTextLayer) in C:\Zaloga\Pinta-master\Pinta.Tools\Tools\TextTool.cs:line 965
   at Pinta.Tools.TextTool.OnMouseDown(DrawingArea canvas, ButtonPressEventArgs args, PointD point) in C:\Zaloga\Pinta-master\Pinta.Tools\Tools\TextTool.cs:line 548
   at Pinta.Core.BaseTool.DoMouseDown(DrawingArea canvas, ButtonPressEventArgs args, PointD point) in c:\Zaloga\Pinta-master\Pinta.Core\Classes\BaseTool.cs:line 111
   at Pinta.Gui.Widgets.PintaCanvas.<.ctor>b__2(Object sender, ButtonPressEventArgs e) in c:\Zaloga\Pinta-master\Pinta.Gui.Widgets\Widgets\Canvas\PintaCanvas.cs:line 60
  --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at GLib.Signal.ClosureInvokedCB(Object o, ClosureInvokedArgs args)
   at GLib.SignalClosure.Invoke(ClosureInvokedArgs args)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
============

Tags: text-tool
Revision history for this message
Cameron White (cameronwhite91) wrote :

I haven't been able to reproduce it yet with the latest development build on Windows 8. Are you able to get this to happen every time, or is it just an occasional thing?

tags: added: text-tool
Revision history for this message
grofaty (grofaty) wrote :

Strange thing, yesterday I could reproduce it multiple time in a role. Now I have tested this problem in deep and I see it only appears if text is marked and then clicked (step 6) EXACTLY bellow the text, e.g. exactly bellow the "e" letter from test (see attachment for details) - if clicked that way I can always reproduce the problem. But if clicked (step 6) on any other position and Pinta does not crash. If also clicked too low it does not crash. But as I written before if clicked exactly bellow "e" letter, I can reproduce this problem every time.

Revision history for this message
grofaty (grofaty) wrote :

Now I can also reproduce the problem from reported bug 1186871.

Revision history for this message
Cameron White (cameronwhite91) wrote :

Thanks, I can reproduce this now. Seems to really depend on where you click.

This is probably a regression since a lot of changes were made to the text tool for 1.5, so I'll target this for 1.5.

Changed in pinta:
importance: Undecided → Medium
milestone: none → 1.5
status: New → Confirmed
Revision history for this message
Cameron White (cameronwhite91) wrote :
Changed in pinta:
assignee: nobody → Cameron White (cameronwhite91)
status: Confirmed → Fix Committed
Revision history for this message
grofaty (grofaty) wrote :

Tested on master on Windows XP and I can confirm this bug is fixed. Thanks.

Changed in pinta:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.