Save as XAML crashes

Bug #168896 reported by Heuertk
6
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Ted Gould
0.46.x
Fix Released
Medium
Unassigned

Bug Description

Using dev build Inkscape0709191324.7z on Win Vista 32-bit

1) Launch inkscape.exe
2) import or create new file
3) save as...
4) choose Microsoft XAML
5) crash (no xaml file created)

running gbd produces:
Program received signal SIGTRAP, Trace/breakpoint trap.
0x77ce2ea9 in ntdll!DbgUiConvertStateChangeStructure () from ntdll.dll
(gdb) bt
#0 0x77ce2ea9 in ntdll!DbgUiConvertStateChangeStructure () from ntdll.dll
#1 0x77d4f19c in ntdll!RtlpNtMakeTemporaryKey () from ntdll.dll
#2 0x00227dbe in ?? ()
#3 0x00f93808 in intl!bind_textdomain_codeset ()
#4 0x002f0000 in ?? ()
#5 0x00000000 in ?? () from
#6 0x0022e93c in ?? ()
#7 0x77cb3e35 in ntdll!RtlWalkFrameChain () from ntdll.dll
#8 0x0022e93c in ?? ()
#9 0x77cb3e7e in ntdll!RtlWalkFrameChain () from ntdll.dll
#10 0x77cb3eb8 in ntdll!RtlWalkFrameChain () from ntdll.dll
#11 0x00227dda in ?? ()
#12 0x00000020 in ?? ()
#13 0x00000002 in ?? ()
#14 0x77d6cf88 in ?? ()
#15 0x00000022 in ?? ()
#16 0x00230000 in ?? ()
#17 0x0022fab8 in ?? ()
#18 0x0022e93c in ?? ()
#19 0x0022e904 in ?? ()
#20 0x00000000 in ?? () from
#21 0x0022e98c in ?? ()
#22 0x77ca8bf2 in ntdll!EtwSetMark () from ntdll.dll
---Type <return> to continue, or q <return> to quit---

Revision history for this message
Heuertk (heuertk) wrote :
Revision history for this message
Heuertk (heuertk) wrote :

Originator: YES

File Added: Eric.svg

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Originator: NO

works for me on linux, but importing back the resulting .xaml makes it all
scattered - seems some trouble with transforms again, see attached
File Added: Eric.xaml

vonHalenbach (lustik)
Changed in inkscape:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
David Carson (dmcarson) wrote :

I was just trying to create a sample XAML file from Inkscape and, wow, did it crash in a hurry. Would be great for this to work.

Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

David, please specify operation system you were using

Revision history for this message
David Carson (dmcarson) wrote : RE: [Bug 168896] Re: Save as XAML crashes

Sorry, Vista Ultimate SP1.

Thanks!

David

-----Original Message-----
From: <email address hidden> [mailto:<email address hidden>] On Behalf Of Alexandre Prokoudine
Sent: Tuesday, February 12, 2008 6:25 AM
To: <email address hidden>
Subject: [Bug 168896] Re: Save as XAML crashes

David, please specify operation system you were using

--
Save as XAML crashes
https://bugs.launchpad.net/bugs/168896
You received this bug notification because you are a direct subscriber
of the bug.

Status in Inkscape: A Vector Drawing Tool: Confirmed

Bug description:
Using dev build Inkscape0709191324.7z on Win Vista 32-bit

1) Launch inkscape.exe
2) import or create new file
3) save as...
4) choose Microsoft XAML
5) crash (no xaml file created)

running gbd produces:
Program received signal SIGTRAP, Trace/breakpoint trap.
0x77ce2ea9 in ntdll!DbgUiConvertStateChangeStructure () from ntdll.dll
(gdb) bt
#0 0x77ce2ea9 in ntdll!DbgUiConvertStateChangeStructure () from ntdll.dll
#1 0x77d4f19c in ntdll!RtlpNtMakeTemporaryKey () from ntdll.dll
#2 0x00227dbe in ?? ()
#3 0x00f93808 in intl!bind_textdomain_codeset ()
#4 0x002f0000 in ?? ()
#5 0x00000000 in ?? () from
#6 0x0022e93c in ?? ()
#7 0x77cb3e35 in ntdll!RtlWalkFrameChain () from ntdll.dll
#8 0x0022e93c in ?? ()
#9 0x77cb3e7e in ntdll!RtlWalkFrameChain () from ntdll.dll
#10 0x77cb3eb8 in ntdll!RtlWalkFrameChain () from ntdll.dll
#11 0x00227dda in ?? ()
#12 0x00000020 in ?? ()
#13 0x00000002 in ?? ()
#14 0x77d6cf88 in ?? ()
#15 0x00000022 in ?? ()
#16 0x00230000 in ?? ()
#17 0x0022fab8 in ?? ()
#18 0x0022e93c in ?? ()
#19 0x0022e904 in ?? ()
#20 0x00000000 in ?? () from
#21 0x0022e98c in ?? ()
#22 0x77ca8bf2 in ntdll!EtwSetMark () from ntdll.dll
---Type <return> to continue, or q <return> to quit---

Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

I'm running SVN trunk build revision 17846 on Vista SP1

I'll post some intermediate debugging results in this issue.

The line filedialogimpl-win32.cpp:1373
 _result = GetSaveFileNameW(&ofn) != 0;
changes the current path from the inkscape starting dir to the dir selected in the save as dialog.

In the method XSLT::solve_reldir in xslt.cpp:70 the line
    Inkscape::Extension::Extension::search_path[i],
enumerates search_path (two entries), the first entry contains "%APPDATA%\Inkscape\extensions"
the second contains "share\extensions".
Later Inkscape::IO::file_test is used to test if the filename exists. When the dialog has changed the current path to the save-dir the relative path "share\extensions" points to the wrong location.

The solve_reldir is used to lookup the filename and path for the svg2xaml.xsl-file. When that lookup fails the whole save-procedure can't complete.

Approach for fix:
Change Inkscape::Extension::Extension::search_path[1] to an absolute path when initializing.
I find this the most robust solution in this case.

An alternative solution would be to restore the current path after the "_result = GetSaveFileNameW(&ofn) != 0;"-line, but I guess that the Open-dialog or something else will change the current path sooner or later. Thus I don't think that's a reliable solution.

Any objections?

Revision history for this message
Ted Gould (ted) wrote :

On Tue, 2008-03-11 at 13:59 +0000, Albin Sunnanbo wrote:
> Any objections?

No. Please post a patch, thank you for the help!

  --Ted

Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

There might be another solution also.
The extensions are loaded correctly at Inkscape startup, it might be possible to keep the extensions loaded with the correct path already set.

Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

Here is a patch for the relative search_path issue.
Fixes both Windows XP and Vista in that issue.

The patch is for trunk.

The XAML-save now works on Windows XP, but still not on Vista.
(at least) It's back crashing as described above.

The line
        tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX");
(xslt.cpp:198)
breaks, I'll try to trace it a little bit more.

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Milestoning since the patch should at least be considered for inclusion in 0.46 (crash bug).

Changed in inkscape:
milestone: none → 0.46
status: Confirmed → Triaged
Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

It looks like the bug is in glibmm
When I replace the call to Glib::file_open_tmp with the following metod I works on Vista.
The metod is mostly identical to http://svn.gnome.org/svn/glibmm/branches/glibmm-2-12/glib/src/fileutils.ccg
I only replaced the ScopedPtr<char> to get it compiling.

I'll tidy this thing up tomorrow and will submit a patch then.
I'll look for more uses of Glib::file_open_tmp and try to figure out if they are non-working also.

int XSLT_file_open_tmp(std::string& name_used, const std::string& prefix)
{
  std::string basename_template (prefix);
  basename_template += "XXXXXX"; // this sillyness shouldn't be in the interface

  GError* error = 0;
  gchar *buf_name_used;

  gint fileno = g_file_open_tmp(basename_template.c_str(), &buf_name_used, &error);

  if(error)
    Glib::Error::throw_exception(error);

  name_used = g_strdup(buf_name_used);
  g_free(buf_name_used);
  return fileno;
}

Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

Here comes a patch for the Vista-issue

To be used together with the http://launchpadlibrarian.net/12587874/init.cpp.patch patch

I did some refactoring and put all temp file creation in sys.cpp
Then I applied the fix in the new temp-method.
Thus it's only one place to revert if glibmm comes with a fix later on or if another tempfile strategy is to be used.
I only include the workaround in the WIN32-builds, the other builds still uses the Glib::file_open_tmp (through the refactored metod).

Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

The file eric.svg gets a scatterd when saved as xaml, but that should be another bug.

Revision history for this message
theAdib (theadib) wrote :

Albin, regarding the temp file issue: The cairo people have done similar things. pls check their implementation:
https://bugs.launchpad.net/inkscape/+bug/177783 and their fix in:
http://gitweb.freedesktop.org/?p=cairo;a=commit;h=4fa46e3caaffb54f4419887418d8d0ea39816092
I have seen that inkscape has one position where it creates a temp file. This was in the nativ postscript output.
HTH, Adib.

Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

I'll look if I can reuse their solution.
It is not the same problem here, temp-files are created in the correct place here. The error seems to be a memory issue when the returned filename is not valid when the call returns.
Although not the same cause, the solution might be useful here also.

Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

The above patches are applied to trunk in revision 17887 and 17888.
I found the Cairo solution to be a larger change and thus a higher probability for introducing new bugs. So I stuck with the solution above.

Can anyone on Linux confirm that this solution does not break anything?
I have tested (as good as a developer can test his own code) on Vista SP1 and WinXP.

If there are no side effects reported then I suppose Ted as assignee for the bug promotes this for inclusion in .46

Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

To compile successfully on Linux the following patch is also needed

Index: sys.cpp
===================================================================
--- sys.cpp (revision 17890)
+++ sys.cpp (revision 17891)
@@ -16,6 +16,7 @@
 #endif

 #include <glib/gutils.h>
+#include <glibmm/fileutils.h>
 #if GLIB_CHECK_VERSION(2,6,0)
     #include <glib/gstdio.h>
 #endif

Revision history for this message
bbyak (buliabyak) wrote :

i confirm that opening and saving XAML files works fine in linux as of rev 17891

Revision history for this message
Ted Gould (ted) wrote :

Marked as fixed.

Changed in inkscape:
importance: Low → Medium
status: Triaged → Fix Released
Revision history for this message
Bryce Harrington (bryce) wrote :

There are several patches mentioned in this bug report; it's unclear to me which of them need to be included in the 0.46.0 windows build. Could someone flag the one(s) I should snag?

Revision history for this message
Albin Sunnanbo (albin-sunnanbo) wrote :

This is a compund patch of all above patches.

Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks, got it.

Revision history for this message
Rygle (rygle) wrote :

Changing to "Fix Released" so Launchpad counts as closed in stats

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.