Using File | Save As for the SECOND time produces exception.

Bug #704265 reported by Miloš Mandarić
46
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Pinta
Fix Released
High
Cameron White

Bug Description

Ubuntu 10.10
Version: 0.6-1~webupd8~maverick
From this repository: ppa:nilarimogard/webupd8

I can reproduce it this way:

1. Open any image which has uppercase extension. (test.JPG)
2. Save as... (give it any name with any extension)
3. Save

And it gives me the exception:

 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Argument cannot be null.
Parameter name: key
  at System.Collections.Generic.Dictionary`2[Gtk.FileFilter,Pinta.Core.FormatDescriptor].get_Item (Gtk.FileFilter key) [0x00000] in <filename unknown>:0
  at Pinta.DialogHandlers.SaveFileAs (Pinta.Core.Document document) [0x00000] in <filename unknown>:0
  at Pinta.DialogHandlers.HandlePintaCoreActionsFileSaveAsActivated (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (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) [0x00000] in <filename unknown>:0
  --- 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) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0

There is a workaround. You need to select the type of image/extension(any type) in the box in the down-right corner.

Tags: crash windows
description: updated
tags: added: maverick
tags: added: i386
Revision history for this message
grofaty (grofaty) wrote :

I can reproduce the same bug in Pinta 0.6 on Ubuntu using ppa:nilarimogard/webupd8 PPA. I can also reproduce the problem on Pinta 0.6 on Windows.

Changed in pinta:
status: New → Confirmed
Revision history for this message
Jonathan Pobst (jpobst) wrote :

I cannot reproduce this on windows. Can you give exact instructions? Like how are you opening the file?

Revision history for this message
Miloš Mandarić (mandzo18) wrote :

1. Run Pinta
2. File/Open
3. Select picture.JPG
4. Open it
5. File/Save as
6. picture2.jpg
7. Save

Revision history for this message
grofaty (grofaty) wrote :

I think this is the same but as https://bugs.launchpad.net/pinta/+bug/702029 the problem is not with upper/lowwer letters of jpg/JPG but with File | Save as.

Try this:
1. Run Pinta
2. You can do some drawing if you like, but I didn't I just selected File | Save as
3. Save Image File window opens, you can name the file as ever you like (with upper or lower letters), I have done the following: picture.jpg

But look into the File type you will see file type is selected (it depends on what was the last file type you have used, because it remembers file type). So far no problem.
4. Now you can do some additional drawing if you like, but I didn't I just selected File | Save as AGAIN (first time was at step 2). Name the file what ever you like, but please look at file type drop-down window - it becomes blank! So if you click on Save button you will get an error. But if you select some file type like jpg everything should be working fine.

I think that Pinta should ALWAYS remember the last file type that was used to save a file. If the file was never saved before it should use one of the file types like PNG. In my humble opinion Pinta should NEVER left file type drop-down list empty.

Revision history for this message
grofaty (grofaty) wrote :
summary: - Can't save file with uppercase extension (.JPG)
+ Using File | Save As for the SECOND time produces exception.
Revision history for this message
grofaty (grofaty) wrote :

In my humble opinion Pinta should NEVER left file type drop-down list empty... And additionally Pinta should ALWAYS respect the file type that is written in Name field.

Revision history for this message
grofaty (grofaty) wrote :

I have market but 702029 ad duplicate of this but. There is also the same but report in 713486 that is also market as duplicate of this bug.

Revision history for this message
Miloš Mandarić (mandzo18) wrote :

Yes I did write that, at the end of my first post. That's exactly the problem. Bug occurs when file type in drop-down list is empty, and that happens only when you open the file with uppercase file-type: .JPG.

Revision history for this message
grofaty (grofaty) wrote :

Now I have also tried this problem in Pinta 0.6 on Ubuntu 10.10 using moonlight PPA and it can't be reproduced the same way. I have tried many times to use File | Save as and named the file with different extensions like jpg, png but Pinta saved file successfully. But when I have used extension with upper letters like JPG and the next time File | Save as is selected the file type drop-down list is empty.

It does look like Pinta is having some problem with upper/lower letters in Ubuntu.

Revision history for this message
grofaty (grofaty) wrote :

Miloš, in my case it does happen every time I use File | Save as for SECOND time.

Revision history for this message
grofaty (grofaty) wrote :

Miloš, maybe we are not using the same Gtk# for .Net. I am using officially supported 2.12.9 version from http://pinta-project.com/download

Revision history for this message
grofaty (grofaty) wrote :

On Windows XP sp3 using Pinta 0.6. Now I have uninstalled Gtk# 2.12.9 and downloaded 2.12.10 Gtk# from http://ftp.novell.com/pub/mono/gtk-sharp/ and the problem still appears when I use File | Save As for the SECOND time.

P.S. On Ubuntu 10.10 I have installed Pinta 0.6 from ppa:nilarimogard/webupd8
In post #8 I have wrongly written that I have installed it from moonlight PPA.

Revision history for this message
Miloš Mandarić (mandzo18) wrote :

I have upgraded to Ubuntu 11.04. Using now 0.6-1 from Ubuntu repositories.
Gtk# libgtk2.0-cil version is 2.12.10-1ubuntu1
I can reproduce this bug every time.

Revision history for this message
grofaty (grofaty) wrote :

Miloš, yes I have also noted on Ubuntu 10.10 using Pinta 0.6 that this problem only appears if upper letters are used when saving. But on Windows it also appears when every second save as is used. So it may be different Gtk# use or something like that.

BTW, I have asked Jonathan what is recommended version of Gtk# for Pinta 0.6 and he answered that it is still Gtk# v2.12.9, because of bugs of 2.12.10 on Windows.

Whole answer was:
=========================================================
There are a couple of issues with Gtk# 2.12.10 (for windows).

- If you do an upgrade from 2.12.9 without removing 2.12.9 manually
first, no files get copied, so nothing works.

- On some systems, the codecs for jpegs do not get correctly registered,
so if you try to open or save as jpg, Pinta will crash.

Until there is a 2.12.11 that fixes these issues, I recommend people use
2.12.9.

Jonathan
=========================================================

Revision history for this message
Jonathan Pobst (jpobst) wrote :

I still cannot reproduce this bug, so I tried to defensively code against anything that I thought could cause this.

https://github.com/jpobst/Pinta/commit/42e75968fdeab331af3b78683c2c3141707fe472

Changed in pinta:
importance: Undecided → High
milestone: none → 0.7
status: Confirmed → Fix Committed
Revision history for this message
grofaty (grofaty) wrote :

I have installed Pinta 0.7 on Windows XP and I can see this bug is not fixed. Please see comment #4 in this bug report to reproduce the problem. I am marking this bug back to New.

Changed in pinta:
status: Fix Committed → New
Revision history for this message
grofaty (grofaty) wrote :

Just a note, I have installed Pinta 0.8 on Windows XP and bug is not fixed. I can reproduce a bug following comment #4.

Jonathan Pobst (jpobst)
Changed in pinta:
milestone: 0.7 → 1.0
Revision history for this message
grofaty (grofaty) wrote :

Today I have also tested this bug on Pinta 0.8 on Ubuntu 10.10 using PPA: nilarimogard/webupd8 from: http://www.webupd8.org/2011/04/install-pinta-08-in-ubuntu-now.html and problem is fixed.

I have rechecked on Pinta 0.8 on Windows XP and this problem is exists. It looks like this problem only appears on Windows. Maybe this is because of Gtk# version differences?

Revision history for this message
Jonathan Pobst (jpobst) wrote :

I think I figure this out and fixed it in:
https://github.com/jpobst/Pinta/commit/693563bcc7f0fc4e6a29aad1773646c3d3fee669

The empty box was caused by setting the FileChooserDialog filename to "blah.jpg2" when "jpg2" wasn't a valid filter.

Now, if we don't have a filter, we change the extension to whatever is our default filter.

Thanks for the report and continuing to test and provide more info!

Changed in pinta:
status: New → Fix Committed
Revision history for this message
grofaty (grofaty) wrote :

I have installed Pinta 1.0 on Windows XP sp3 and I can confirm problem is still not solved (following comment #4 instructions). Exception is "System.ArgumentNullException: Argument cannot be null." (see first post of this bug report).

Changed in pinta:
status: Fix Committed → New
Revision history for this message
Robert Nordan (rpvn) wrote :

The bug described in the original post still happens in Pinta master, the exception is caused by the file type selector being blank when following the described steps.

The approach described in comments 4 & 20 does not seem to cause an exception anymore.

Changed in pinta:
status: New → Confirmed
Revision history for this message
grofaty (grofaty) wrote :

Are you using Windows XP sp3 to test this bug? If not then you probably don't have a problem at all. Jonathan was not able to reproduce the problem and just tried to do some work-around to prevent the error, but never solved it. I will test this issue for sure when new version of Pinta is released, this is one of the most annoying bugs for me.

Revision history for this message
beajeanm (jeanmichel-bea) wrote :

I've suggested a fix.
The pull request is awating here:
https://github.com/PintaProject/Pinta/pull/7

Changed in pinta:
assignee: nobody → beajeanm (jeanmichel-bea)
Revision history for this message
Cameron White (cameronwhite91) wrote :
Changed in pinta:
milestone: 1.0 → none
status: Confirmed → Fix Committed
Revision history for this message
grofaty (grofaty) wrote :

I have installed Pinta 1.1 on Windows XP sp3 and I can confirm problem is still not solved (following comment #4 instructions).
This is nasty bug. Probably related to some environment like Windows XP sp3 and Gtk# combination. I am using Gtk# for .Net 2.12.10.

Changed in pinta:
status: Fix Committed → New
Revision history for this message
Cameron White (cameronwhite91) wrote :

Can someone who was able to reproduce this issue try it with Pinta 1.2 (on Windows and Linux, if possible)?

Revision history for this message
grofaty (grofaty) wrote :

Tested on Pinta 1.2 (reproducing the step from #4 of this thread) on Windows and after step 4 I get new error (never got this error before - see attachment for error message).

But when closing this error message (with X at top-right), selecting "PNG" file type from file type and saving file, it saves without a problem.

Revision history for this message
grofaty (grofaty) wrote :

Now I have also tested on Ubuntu 11.10 latest development compiled from source. No problem on Ubuntu. But this problem never appeared on Ubuntu on my system, but always a Windows XP problem.

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

I was able to reproduce this with Pinta 1.2 on Windows XP in a virtual machine.

Changed in pinta:
status: New → Confirmed
assignee: beajeanm (jeanmichel-bea) → nobody
grofaty (grofaty)
tags: removed: i386 maverick
Revision history for this message
grofaty (grofaty) wrote :

I have tested this on Pinta 1.3-preview on Windows XP and this bug still appears. This is in my humble opinion No. 1 annoying bug on Pinta for Windows XP for about a year now.

tags: added: windows
Revision history for this message
grofaty (grofaty) wrote :

I have looked at this problem again (Pinta 1.3-preview on Windows XP) and I have noticed, that now it is little bit different message then few days ago (in this thread #27). Now I get error message:

==========
System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Pinta.Actions.SaveDocumentImplmentationAction.OnFilterChanged(Object o, NotifyArgs args) in d:\Programming\CSharp\Pinta\Pinta\Pinta\Actions\File\SaveDocumentImplementationAction.cs:line 255
   at GLib.Object.NotifyCallback(IntPtr handle, IntPtr pspec, IntPtr gch)
==========
What I notice is some path like d:\Programming\CSharp\Pinta\Pinta\Pinta\ActionsFile\SaveDocumentImplementationAction.cs
This path does not exists on my computer - most probably was the path on system where Pinta was build or something.

Revision history for this message
grofaty (grofaty) wrote :
Download full text (3.5 KiB)

Pinta 1.3-dev-preview on Windows XP. Now I have realized that actually now there are two crashes appearing when saving file with Save As second time. So this got to be some regression from previous week.

1. Open Pinta and open new file File | New.
2. You don't need to draw anything, just use File | Save and save file e.g.: test.png and click on Save button.
3. You don't need to change anything on canvas just use File | Save As. Error appears (this error got to be a regression, because I haven't got this error previos week):
=========
System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Pinta.Actions.SaveDocumentImplmentationAction.OnFilterChanged(Object o, NotifyArgs args) in d:\Programming\CSharp\Pinta\Pinta\Pinta\Actions\File\SaveDocumentImplementationAction.cs:line 255
   at GLib.Object.NotifyCallback(IntPtr handle, IntPtr pspec, IntPtr gch)
=========
4. Click on "X" in top-right to close error message.
5. From file-type selection there is empty drop-down box! In Name field type in: test2.png and click on Save button.
6. Another error pops-up:
=========
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.

Parameter name: key
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Pinta.Actions.SaveDocumentImplmentationAction.SaveFileAs(Document document) in d:\Programming\CSharp\Pinta\Pinta\Pinta\Actions\File\SaveDocumentImplementationAction.cs:line 134
   at Pinta.Actions.SaveDocumentImplmentationAction.Activated(Object sender, DocumentCancelEventArgs e) in d:\Programming\CSharp\Pinta\Pinta\Pinta\Actions\File\SaveDocumentImplementationAction.cs:line 58
   at Pinta.Core.FileActions.RaiseSaveDocument(Document document, Boolean saveAs)
   at Pinta.Core.Document.Save(Boolean saveAs)
   at Pinta.Actions.SaveDocumentAsAction.Activated(Object sender, EventArgs e) in d:\Programming\CSharp\Pinta\Pinta\Pinta\Actions\File\SaveDocumentAsAction.cs:line 48
   --- 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)
==========
7. Click on "X" in top-right to close error message.
8. Now you a...

Read more...

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

The second crash is probably caused by having an empty file filter in step 5.

grofaty (grofaty)
tags: added: crash
Revision history for this message
Cameron White (cameronwhite91) wrote :

I'm still not entirely sure why the file filter was blank only on Windows XP, but I've fixed the crash: https://github.com/PintaProject/Pinta/commit/aaab675fae9ff4738fb47f854ce96891fb4e6c04.

Verified on Windows XP in a virtual machine.

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

At #33, yes second crash is due to step 5 - empty filter list entry (this only appears on Windows XP). This crash was also reported in #4 of this bug report.

At #34, I will definitely check this when new Pinta's Windows preview is out. I am very interested to get rid of this annoying bug.

Revision history for this message
grofaty (grofaty) wrote :

I have downloaded/tested with pinta-1.3-preview-20120426 on Windows XP. Trying to repeat steps from #32 post of this thread.

After step 3 I get this error:
============
System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Pinta.Actions.SaveDocumentImplmentationAction.OnFilterChanged(Object o, NotifyArgs args)
   at GLib.Object.NotifyCallback(IntPtr handle, IntPtr pspec, IntPtr gch)
============
You notice error is not exactly the same as in #32, but it happens in exactly the same action.

After step 6 exactly the same error appears:
============
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: key
  at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Pinta.Actions.SaveDocumentImplmentationAction.SaveFileAs(Document document)
   at Pinta.Actions.SaveDocumentImplmentationAction.Activated(Object sender, DocumentCancelEventArgs e)
   at Pinta.Core.FileActions.RaiseSaveDocument(Document document, Boolean saveAs)
   at Pinta.Core.Document.Save(Boolean saveAs)
   at Pinta.Actions.SaveDocumentAsAction.Activated(Object sender, EventArgs e)
   --- 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)
============

So both problems still exists.

Revision history for this message
grofaty (grofaty) wrote :

Ahhhhhhhhhhh, sorry false report. Now I have found out that something got to be wrong with installation of this new version. Some of the files in C:\Program files\Pinta was correctly overwritten and some were not. Don't know if I have made some mistake when installing or there is a bug in installation procedure. OK, now I have completely uninstall Pinta and deleted Pinta left overs in directory and installed in one more time.

Retested and problem is fixed! That was one most annoying bug fixed in Pinta. Excellent job! Thanks million times.

Robert Nordan (rpvn)
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.