[Libreoffice-bugs] [Bug 135330] With Screen Reader NVDA LibreOffice Crashes if a Word Count is Performed
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Sat Aug 1 21:06:30 UTC 2020
https://bugs.documentfoundation.org/show_bug.cgi?id=135330
--- Comment #8 from Mike Kaganski <mikekaganski at hotmail.com> ---
> static bool
> ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet)
> {
> // IA2 should be enabled automatically
> AllSettings aSettings = Application::GetSettings();
> MiscSettings aMisc = aSettings.GetMiscSettings();
> aMisc.SetEnableATToolSupport( true );
> aSettings.SetMiscSettings( aMisc );
> Application::SetSettings( aSettings );
> ...
So I see a bunch of problems here. Some background:
AllSettings has a shared pointer to ImplAllSettingsData.
ImplAllSettingsData includes a MiscSettings, which has a shared pointer to
ImplMiscData.
So in the end, aMisc has a shared pointer to the same ImplMiscData as used in
Application::GetSettings. So aMisc.SetEnableATToolSupport, although looks like
operating on a "copy" of a const reference returned by those const member
functions Application::GetSettings and AllSettings::GetMiscSettings, in fact
changes the shared state. Is this intentional? Not here, but elsewhere, where a
similar thing might happen?
Then AllSettings::SetMiscSettings calls CopyData, which checks use count, which
is naturally >1 (we have the local object in addition to the global one, both
referencing same data), and duplicates everything. Then in
Application::SetSettings, the copy will get , and original will be destroyed
... just because we changed true to true.
Because we do that unconditionally - even if
Application::GetSettings().GetMiscSettings().GetEnableATToolSupport() is
already true. Why?
So one sure thing is to add a check before this; but how to proceed further?
should I keep this expensive replacement of all settings, or should I make use
of this implementation detail that aMisc.SetEnableATToolSupport already did all
I needed?
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200801/d8182c18/attachment.htm>
More information about the Libreoffice-bugs
mailing list