Skip to content
  • Tobias Deiminger's avatar
    Fix crash due to dangling pointer in MouseAnnotation · 3c4f16ea
    Tobias Deiminger authored and Albert Astals Cid's avatar Albert Astals Cid committed
    Summary:
    BUG: 388228
    
    Diff applies to Applications/17.12, and should be easy to merge to master. It's kept quite minimal as suggested by Albert.
    
    Albert also suggested to add a dedicated unit test and I'd agree, but am not yet sure how to do it. The original bug involves several classes, including UI: Document, Page, AddAnnotationCommand, PageView, PageViewAnnotator, MouseAnnotation - to name a few. So a test for the exact bug scenario would become a bigger integration test rather than an isolated unit test. The other approach would be to do a real unit test on MouseAnnotation. But again, MouseAnnotation has nasty dependencies (e.g., needs a parent PageView) which I'd have to mock. Any ideas? I'd be interested in a discussion on this topic.
    
    Test Plan:
     # Load a document (e.g. [[ http://www.philipebert.info/resources/WhatMathematicalKnowledgeCouldNotBe.pdf | linked PDF from bug report ]]) and enable highlight toolbar (F6).
     # Create highlight annotation...
    3c4f16ea