davidhurka added a comment.

  In D18744#438076 <https://phabricator.kde.org/D18744#438076>, @shubham wrote:
  
  > @aacid area is a RegularAreaRect object which is a QRect bounding the 
selected text. "area" is to be deleted in all the cases except the case in 
which it is not possible to delete it since "area" will not contain any text in 
it and hence it will be nullptr. (case: if text is empty string) and hence 
return is called instead of deleting the "area".
  
  
  Wait, stupid question: You assume `area` to be `nullptr` if there is no text 
on the page?
  
  You do `area = TextSelectionForItem( item );`, 
PageView::TextSelectionForItem() unconditionally returns a 
`Okular::RegularAreaRect *` which it got from TextPage::TextArea(). 
TextPage::TextArea() does `return new RegularAreaRect();` if 
TextSelectionForItem() is called on an empty page, and `RegularAreaRect * ret= 
new RegularAreaRect; [complicated] return ret; [or] ret->addShape([...]); 
return ret` otherwise.
  
  TextSelectionForItem() tests whether it gets `nullptr` from TextArea(). But 
how can TextArea() return `nullptr` at all? `new RegularAreaRect()` vs. `new 
RegularAreaRect`?

REPOSITORY
  R223 Okular

REVISION DETAIL
  https://phabricator.kde.org/D18744

To: shubham, aacid, #vdg, ngraham
Cc: yurchor, michaelweghorn, kde-doc-english, davidhurka, abetts, loh.tar, 
alexde, ngraham, okular-devel, gennad, joaonetto, tfella, skadinna, darcyshen, 
aacid

Reply via email to