Dear Romano,

Thanks very much for pointing this out. I believe the bug was introduced 
in 0.4.6 when, for Windows compatibility, a lot of file-reading modes 
were changed from "r" to "rb" ("binary", i.e. don't attempt end-of-line 
character conversions).  For fopen() this is innocent, but for some 
incomprehensible reason, the second argument to popen() in linux can't 
be "rb" -- instead of ignoring the useless "b" silently, this gives an 
EINVAL error that we ignored silently. The code for pclose() then failed 
to check whether the pipe was valid.

Problem fixed by:
- calling popen() with "rb" in Windows and "r" in Linux (so that it has 
a chance of working)
- checking before calling pclose() whether the pipe is non-NULL (so that 
if popen() failed anyway we don't crash)
- and also adding a shell-quote for the PS/PDF file name on the gs 
command line (so that it can work on filenames that contain spaces)

This should be fixed in the cvs and git repositories now. Let me know if 
not.

That said, using Page->Load background on a PS/PDF file is not a 
recommended thing to do in general, because it just converts the PS/PDF 
pages into static medium-resolution bitmaps using ghostscript. These 
bitmaps look okay on screen, but occupy a fair bit of disk space when 
saved, and are probably not good enough quality for printing. So it is 
in general much, much better to just use Annotate PDF to have whatever 
background PDF file you want. (Granted, because only one PDF background 
file can be annotated at a time, this will not let you mix and match 
different PDFs unless you use an external tool to produce the merged PDF 
file that xournal will annotate -- but the rendering quality on screen 
and in print is just way better.)

Denis



On 03/20/2015 02:53 PM, Romano Gtti (comp) wrote:
> I have a very easy to reproduce crash with xournal 0.4.8 (it is really
> 59f59806864ebb from git source), on a Linux machine (Ubuntu 14.04.2).
>
> I normally write notes by loading a PDF page as background, select "all
> page same background", and start writing things.
> Now, If I try to change the background with Page->Load background to
> load another PDF file, the dialog opens and as soon as I choose another
> background file(1) xournal crashes with a segmentation fault.
>
> Examples in
> https://dl.dropboxusercontent.com/u/57662186/xournal-crash-bg.tar.gz
>
> Can you reproduce it? It happens always for me.
>
>       Romano
>
> (1) not related, but sometime the file chooser dialog hangs too ---
> completely unresponsive (buttons reacts visually to clicks but nothing
> happens --- this is sporadic but definitely happens often.)
>
>
> --
> Romano Giannetti
> http://www.rgtti.com
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Xournal-devel mailing list
> Xournal-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xournal-devel
>

-- 
Denis Auroux
UC Berkeley, Department of Mathematics
817 Evans Hall, Berkeley CA 94720-3840, USA
aur...@math.berkeley.edu

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Xournal-devel mailing list
Xournal-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xournal-devel

Reply via email to