Bug 313147 - Table of contents gets cleared during reload (and after reload too, if cancelled by user)
Summary: Table of contents gets cleared during reload (and after reload too, if cancel...
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 0.16.60
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-12 20:22 UTC by Fabio D'Urso
Modified: 2013-01-15 00:21 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio D'Urso 2013-01-12 20:22:28 UTC
If I open, edit and reload a PDF document both with embedded annotations and table of contents ( e.g. http://www.pdfill.com/example/pdf_commenting_new.pdf ), Okular asks me if I want to save changes or not*.
While the message box is open, in the background I can see that the table of contents has been cleared, and if I press Cancel the document stays open with an empty TOC.

* = This message box is only shown with poppler >= 0.20


Reproducible: Always

Steps to Reproduce:
1. Open pdf_commenting_new.pdf and show the TOC panel
2. Do some modification (e.g. create a new annotation)
3. Press Reload. A "Save changes?" prompt will be shown
4. Watch the TOC disappear in the background
5. Press Cancel
6. The document stays open but the TOC is empty



The issue is that we're calling m_toc->prepareForReload() in Part::slotDoFileDirty() *before* Part::queryClose() is executed.
TOC::prepareForReload() internally replaces the current TOCModel with an empty one, and that's why the table of contents disappears.

This bug should be easy to fix, but I haven't done it myself because it touches the same code as bug 313146, which is more critical.
Comment 1 jaydeep 2013-01-13 00:19:29 UTC
I'm working on it.
Comment 2 Albert Astals Cid 2013-01-15 00:21:55 UTC
Git commit 4fefc60e3518887c5e5b4b7b1a435545480e55c0 by Albert Astals Cid.
Committed on 15/01/2013 at 01:17.
Pushed by aacid into branch 'master'.

Do not prepare the toc for reload until we are really reloading

M  +8    -3    part.cpp

http://commits.kde.org/okular/4fefc60e3518887c5e5b4b7b1a435545480e55c0