Bug 152103 - OutlineView::AddWindowToPaintView is broken after splitting OutputDevice from Window
Summary: OutlineView::AddWindowToPaintView is broken after splitting OutputDevice from...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard:
Keywords: implementationError
Depends on:
Blocks:
 
Reported: 2022-11-18 09:14 UTC by Mike Kaganski
Modified: 2022-11-18 17:37 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2022-11-18 09:14:12 UTC
Commit 9090dc1f3b27195f5defd35586ac79357992be21 (split OutputDevice from Window, May 17, 2021) made vcl::Window (and its descendants) not inherit from OutputDevice. This silently broke code that used dynamic_cast:

OutlineView::AddWindowToPaintView casts a passed OutputDevice* to sd::Window*. It now will always produce a nullptr.

I do not know how this manifests visibly. I came across this when debugging something else. But it indeed looks very broken.

I also don't have an idea how to fix this. There is code now that passes temporary OutputDevices to AddWindowToPaintView, having no associated vcl::Window, e.g. in SwViewShell::SmoothScroll; so it's not enough to simply change AddWindowToPaintView to take vcl::Window instead, and change all its call sites to pass "parent" vcl::Window instead.

Noel: could you please take a look, how to fix it? Thanks!
Comment 1 Mike Kaganski 2022-11-18 10:05:07 UTC
Oh - there's OutputDevice::GetOwnerWindow - it would fit nicely!
Comment 2 Mike Kaganski 2022-11-18 12:40:41 UTC
https://gerrit.libreoffice.org/c/core/+/142942