Ticket #43 (closed task: fixed)

Opened 2 years ago

Last modified 18 months ago

open dialog only works, if no document is loaded already

Reported by: baze Owned by: jordi
Priority: major Version: 0.1.5
Keywords: Cc:

Description

for example you just run epdfview. no document is opened. now use the open dialog to load a file. the file is loaded, but when you try to open another file, the current file is reloaded.

or run epdfview foo.pdf to load foo.pdf. the file is loaded (if it didn't crash ;/) but when you then use the open dialog to open bar.pdf, foo.pdf is reloaded instead of opening bar.pdf.

Change History

Changed 2 years ago by jordi

OK, there's definitely something that ePDFView doesn't like on your system and I don't really know what it is. :-)

I'll try ePDFView in other configurations besides the ones at home and at work (they are both the same distro, although different archs) and different compilers (I didn't tried it on gcc 4.x.x, only gcc 3.4.x). I'm not sure, but this seems related to the problem ePDFView is having in bug #32 you have reopened (btw, don't worry about reopening them when they are not finished).

I just tried the behaviour you have described and I couldn't reproduce it (yet) and at work I use it to open datasheets and manual, most of time in the same execution, so I would seen it it it happened on my configuration.

Since you mentioned it I'll take a look of "potential harmful" changes from 0.1.3 and 0.1.4, although I think it's heavily related to threading.

Sorry for not being of any help for now, I just need to investigate a little more. And thank you for you patience.

Changed 2 years ago by LoneFox

Actually the new document is loaded (index and title are changed) but epdfview displays (cached?) pages from the old one. It seems to happen only if the new document is a big one, files with about 50 pages work correctly but one that has over 600 pages does not.

Changed 2 years ago by baze

you're right, the title and index are updated. but the main page isn't loaded for me, even if the document i try to open only has 1 or 2 pages.

Changed 2 years ago by LoneFox

Looks like I was wrong about the file size thing... This patch should fix the problem:

diff -ur epdfview-0.1.5-orig/src/IDocument.cxx epdfview-0.1.5/src/IDocument.cxx
--- epdfview-0.1.5-orig/src/IDocument.cxx	2006-06-11 20:03:42.000000000 +0300
+++ epdfview-0.1.5/src/IDocument.cxx	2006-07-17 22:55:41.000000000 +0300
@@ -276,6 +276,19 @@
 void
 IDocument::notifyLoad ()
 {
+    // Empty the cache to avoid displaying pages from previous file
+    G_LOCK (pageSearch);
+    while ( GList *tmp = g_list_first (m_PageCache) )
+    {
+        PageCache *page = (PageCache *)tmp->data;
+        m_PageCache = g_list_remove_all (m_PageCache, page);
+        G_LOCK (pageImage);
+        delete page->pageImage;
+        G_UNLOCK (pageImage);
+        delete page;
+    }
+    G_UNLOCK (pageSearch);
+    
     // Add the two first pages, if they exists, to the cache.
     addPageToCache (1);
     if ( 1 < getNumPages () )

Changed 2 years ago by jordi

  • status changed from new to closed
  • resolution set to fixed

Thanks again LoneFox.

When I saw your patch I remembered that IDocument had a function to clear the page cache, so I use this instead but I had to add the lock/unlock macros. See commit [250].

I tried it with different PDF files (without closing the program) and it works correctly.

Thank you very much!

Note: See TracTickets for help on using tickets.