Thread: Disapearing CSS
View Single Post
Old 03-25-2015, 04:22 PM   #67
pete6055
Connoisseur
pete6055 began at the beginning.
 
Posts: 74
Karma: 10
Join Date: Nov 2012
Device: none
Quote:
Originally Posted by KevinH View Post
FWIW, there is a small gap/race in the TextResource.cpp code between when SetText() is called the first time if it has to cache the text to be loaded because it is not in the GUI thread. It will automatically load the cache into the QTextDocument after a single-shot timer expires when we are back in the GUI thread.

But if a call to SaveToDisk (such as doing a File->SaveAs) is made during that interval it will incorrectly read from the QTextDocument (which is empty because it was waiting to be loaded!) and writing it to disk resulting in the disappearing file.

Technically it could happen to any text based resource (OPF, XHTML, CSS, etc) but initial loading was always done so all you were losing might have been the difference between it and its cache if anything at all.

So I have made an additional change to try to close that tiny hole in Sigil master so we are not bitten by this. It was the same bug that made font url's not be properly updated in CSS files too.

Thanks to all for reporting the bug so we could get this tracked down.

Kevin
Kevin,

This sounds like it explains everything I've reported, with the possible exception of the "file jumping" symptom, and that could simply be a resource issue associated with the conflicts you closed.

I can't wait to test 8.5, whenever it's released. Congrats!!!
pete6055 is offline   Reply With Quote