View Single Post
Old 12-07-2014, 12:09 AM   #30
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,816
Karma: 6000000
Join Date: Nov 2009
Device: many
Hi,
It seems to be a longtime Qt internal bug as far as I can tell. So I have a tentative patch to prevent this crash, that I have tested on Mac OS X, that seems to work.

See below, in case anyone else builds their own, and would like to try the patch. I would appreciate hearing if it works on other platforms.

Thanks,

KevinH


Code:
--- src/Sigil/MainUI/MainWindow.cpp.current	2014-12-06 14:37:02.000000000 -0500
+++ src/Sigil/MainUI/MainWindow.cpp	2014-12-06 22:07:27.000000000 -0500
@@ -2058,13 +2058,21 @@
 
 void MainWindow::RemoveResources(QList<Resource *> resources)
 {
+    // work around Qt bug when deleting png images on page shown by both
+    // BookView and Preview by temporarily hiding the PreviewWindow
+    bool pw_showing = m_PreviewWindow->IsVisible();
+    if ((pw_showing) && (m_ViewState == MainWindow::ViewState_BookView)) {
+        m_PreviewWindow->hide();
+    }
     // Provide the open tab list to ensure one tab stays open
     if (resources.count() > 0) {
         m_BookBrowser->RemoveResources(m_TabManager.GetTabResources(), resources);
     } else {
         m_BookBrowser->RemoveSelection(m_TabManager.GetTabResources());
     }
-
+    if ((pw_showing) && !m_PreviewWindow->IsVisible()) {
+        m_PreviewWindow->show();
+    }
     ShowMessageOnStatusBar(tr("File(s) deleted."));
 }
KevinH is offline   Reply With Quote