https://bugs.documentfoundation.org/show_bug.cgi?id=96888
Bug ID: 96888
Summary: Kill internal vcl dog-tags ...
Product: LibreOffice
Version: 5.1.0.1 rc
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: graphics stack
Assignee: [email protected]
Reporter: [email protected]
We want to remove this structure:
vcl/inc/svdata.hxx
// ImplDelData is used as a "dog tag" by a window when it
// does something that could indirectly destroy the window
// TODO: wild destruction of a window should not be possible
struct ImplDelData
But first we should remove all of its users. Please do this one side by one -
and test them individually. The ideal is that we can push a number of these
patches separately over time - so that we can bibisect back to an individual
patch easily later =)
There is no longer a need for this structure; checkout:
vcl/README.lifecycle.
So instead of its usage we should have:
ImplDelData aDogTag( this ); // 'orrible old code
Show( true, ShowFlags::NoActivate );
if( !aDogTag.IsDead() ) // did 'this' go invalid yet ?
Update();
should be:
VclPtr xWindow(this);
Show( true, ShowFlags::NoActivate );
if( !aDogTag.IsDisposed() )
Update();
Of course 'this' continues to be valid in this case.
There is a small functional change here; if you read:
void Window::dispose()
...
// notify ImplDelData subscribers of this window about the window deletion
... there is some logic here ...
delete mpWindowImpl; mpWindowImpl = nullptr;
}
ie. you will see that the-dog-tags are cleared a few lines before mpWindowImpl
is set to NULL (cf.):
bool Window::IsDisposed() const
{
return !mpWindowImpl;
}
So it is well worth testing each case that is changed; but I think the risk is
reasonably low; and in the few cases that are like this we can use 'isDisposed'
instead - which is set very much earlier =)
Thanks !
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs