Package: epdfview
Version: 0.1.6-3
Severity: normal

Hello,

I got a segmentation fault when trying to open the print dialog. This
never happened to me before epdfview entered into Debian (before I used
to run the svn trunk version and since that, I have never tried to
print a pdf file).

Moreover, there is no crash when I open the print dialog while the cups
server is not running (but of course the print dialog is empty: no
printer queue).

I found that it maybe related to something that was corrected in rev.
281 of svn trunk ("Added check to prevent segfaults while opening the
print dialog if the PPD file doesn't have the option that was
requrested"), then introduced in svn trunk after 0.1.6 release.

Indeed, after rebuilding epdfview package with the patch directly taken
from svn (in attachment, I just put it into the debian/patches
directory), I can now run epdfview without any crash when trying to open
the print dialog.

By the way, what to you think of packaging epdfview from a recent svn
trunk snapshot? It seems more mature and brings many improvements. And
as far as I remember it is at least as stable as the 0.1.6 release.

Best regards,

Pascal Dormeau

--- /trunk/src/PrintPter.cxx (revision 262)
+++ /trunk/src/PrintPter.cxx (revision 281)
@@ -231,17 +231,24 @@
                 view.clearPageSizeList ();
                 int pageSizeToSelect = 0;
-                ppd_choice_t *pageSizeChoice = pageSizeOption->choices;
-                for ( int currentSize = 0 ;
-                      currentSize < pageSizeOption->num_choices ;
-                      ++currentSize, ++pageSizeChoice )
-                {
-                    const gchar *sizeName = pageSizeChoice->text;
-                    const gchar *sizeValue = pageSizeChoice->choice;
-
-                    view.addPageSize (_(sizeName), sizeValue);
-                    if ( pageSizeChoice->marked )
+                if ( 0 != pageSizeOption )
+                {
+                    ppd_choice_t *pageSizeChoice = pageSizeOption->choices;
+                    for ( int currentSize = 0 ;
+                         currentSize < pageSizeOption->num_choices ;
+                         ++currentSize, ++pageSizeChoice )
                     {
-                        pageSizeToSelect = currentSize;
+                        const gchar *sizeName = pageSizeChoice->text;
+                        const gchar *sizeValue = pageSizeChoice->choice;
+
+                        view.addPageSize (_(sizeName), sizeValue);
+                        if ( pageSizeChoice->marked )
+                        {
+                            pageSizeToSelect = currentSize;
+                        }
                     }
+                }
+                else
+                {
+                    view.addPageSize (_("A4"), "A4");
                 }
                 view.selectPageSize (pageSizeToSelect);
@@ -252,17 +259,24 @@
                 view.clearResolutionList ();
                 int resolutionToSelect = 0;
-                ppd_choice_t *resolutionChoice = resolutionOption->choices;
-                for ( int currentRes = 0 ;
-                      currentRes < resolutionOption->num_choices ;
-                      ++currentRes, ++resolutionChoice )
-                {
-                    const gchar *resName = resolutionChoice->text;
-                    const gchar *resValue = resolutionChoice->choice;
-
-                    view.addResolution (_(resName), resValue);
-                    if ( resolutionChoice->marked )
+                if ( 0 != resolutionOption )
+                {
+                    ppd_choice_t *resolutionChoice = resolutionOption->choices;
+                    for ( int currentRes = 0 ;
+                            currentRes < resolutionOption->num_choices ;
+                            ++currentRes, ++resolutionChoice )
                     {
-                        resolutionToSelect = currentRes;
+                        const gchar *resName = resolutionChoice->text;
+                        const gchar *resValue = resolutionChoice->choice;
+
+                        view.addResolution (_(resName), resValue);
+                        if ( resolutionChoice->marked )
+                        {
+                            resolutionToSelect = currentRes;
+                        }
                     }
+                }
+                else
+                {
+                    view.addResolution (_("300 DPI"), "300x300dpi");
                 }
                 view.selectResolution (resolutionToSelect);
@@ -272,7 +286,7 @@
                     ppdFindOption (printerPPD, "ColorModel");
                 view.clearColorModelList ();
+                int colorModelToSelect = 0;
                 if ( NULL != colorModelOption )
                 {
-                    int colorModelToSelect = 0;
                     ppd_choice_t *colorModelChoice = colorModelOption->choices;
                     for ( int currentColor = 0 ;
@@ -289,5 +303,4 @@
                         }
                     }
-                    view.selectColorModel (colorModelToSelect);
                 }
                 else
@@ -295,4 +308,5 @@
                     view.addColorModel (_("Grayscale"), "Gray");
                 }
+                view.selectColorModel (colorModelToSelect);
                 ppdClose (printerPPD);
             }

Reply via email to