restack extension hangs for drawings with many objects

Bug #524481 reported by Rob Antonishen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Rob Antonishen

Bug Description

As posted to the inkscape dev list:

I discovered the restack extension stopped working (under windows XP devel build inkscapeR9097-1002182129) for more than 82 objects in the svg document.

The code calling inkscape with the --query-all parameter (to get all
the bounding boxes) was:

           if bsubprocess:
               p = Popen('inkscape --query-all "%s"' % (file), shell=True, stdout=PIPE, stderr=PIPE)
               rc = p.wait()
               f = p.stdout
               err = p.stderr

It will just hang the python window in such a case.

I found my removing the rc = p.wait() line the extension will work...
but I am not sure of the impact of making that change.

I see the Popen.wait call is used in other extensions as well, but
they all seem to be using the single object query flag --query-id=ID,
so so not experience this problem.

The python docs state Popen.wait "will deadlock if the child process
generates enough output to a stdout or stderr pipe such that it blocks
waiting for the OS pipe buffer to accept more data. Use communicate()
to avoid that."

but it also states that with communicate() "The data read is buffered
in memory, so do not use this method if the data size is large or
unlimited."

su_v (suv-lp)
tags: added: extensions-plugins
Revision history for this message
Alvin Penner (apenner) wrote :

confirmed on Windows XP using the attached file. I get an Inkscape hang (not responding) with a large number of exit messages saying:

(inkscape.exe:2808): GLib-WARNING **: g_main_context_check() called recursively from within a source's check() or prepare() member.

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Rob Antonishen (rob-antonishen) wrote :

I've changed the subprocess code to use communicate() rather than wait().

There was also a new bug introduced (not sure when) where the bundled csv.reader changed to take a file object rather than a string as it was previously. This version has been tested to work both with cvs.py included in the inkscape extensions folder and using the native python csv module if not.

Lastly, the previous version took objects out of layers and into the document root. This version leaves the restacked objects in the layer of the first selected object. Not sure of a more intuitive way to do this, since selections can span layers. It might be possible to leave objects in their own layers, but then the restacking wouldn't appear to work...

-Rob A>

Revision history for this message
Rob Antonishen (rob-antonishen) wrote :

Forgot to mention, I verified this version as working with the provided lorum.svg using Inkscape 0.48+devel r9861 on Windows XP SP3.

-Rob A>

Revision history for this message
jazzynico (jazzynico) wrote :

Fix confirmed on Ubuntu 10.10, Inkscape revision 10012.
Patch committed in the trunk, revision 10013.
Thanks for the fix and improvements!

Changed in inkscape:
importance: Undecided → Low
milestone: none → 0.49
status: Confirmed → Fix Committed
jazzynico (jazzynico)
Changed in inkscape:
assignee: nobody → Rob Antonishen (rob-antonishen)
jazzynico (jazzynico)
tags: added: backport-proposed
Revision history for this message
jazzynico (jazzynico) wrote :

Patch committed in the 0.48.x branch, revision 9800.

Changed in inkscape:
milestone: 0.49 → 0.48.2
tags: removed: backport-proposed
Ted Gould (ted)
Changed in inkscape:
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.