diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-09-20 11:03:10 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-09-20 09:50:56 +0200 |
commit | f317746f55044927a180657f81e21d662102b0c5 (patch) | |
tree | 3fb17df63269b71b8311bd25be34a7b44b2023f4 /desktop/source | |
parent | 8722639f3a270e2903810b85ef40a68cb0a14646 (diff) |
Avoid wrong "no replacement graphic" state when updating OLE graphic
Connecting from an external Java process on Windows, and running a
code similar to this:
XComponent xComponent = xComponentLoader.loadComponentFromURL(url, "_default", FrameSearchFlag.ALL, args);
XTextEmbeddedObjectsSupplier textEmbeddedObjectSupplier = cast(XTextEmbeddedObjectsSupplier.class, xComponent);
XIndexAccess embeddedObjectsAccess = cast(XIndexAccess.class, textEmbeddedObjectSupplier.getEmbeddedObjects());
XEmbeddedObjectSupplier2 embeddedObjectSupplier = cast(XEmbeddedObjectSupplier2.class, embeddedObjectsAccess.getByIndex(0));
for (int i = 0; i < 100; i++)
{
XGraphic replacementGraphic = embeddedObjectSupplier.getReplacementGraphic();
String graphicStatus = replacementGraphic == null ? "missing" : "present";
System.out.println("The replacement graphic is: " + graphicStatus);
}
(when 'url' points to a file with OLE) could produce output like this:
The replacement graphic is: present
The replacement graphic is: present
The replacement graphic is: missing
... 94 more copies of "missing"
The replacement graphic is: missing
The replacement graphic is: present
The replacement graphic is: present
i.e., the replacement graphic suddenly disappears, and then re-appears.
This happens when some idle needs to update the replacement graphic,
e.g. when generating a thumbnail. This happened because the code in
EmbeddedObjectRef::GetReplacement cleared the graphic prior to calls
to OLE object's async methods to get the graphic stream.
The code does not depend on the current content of mpImpl->oGraphic,
so this change takes care to avoid this transient "no graphic" state.
Change-Id: Ia825185a6e9b749697209443ee5db187b5ddbd16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173690
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'desktop/source')
0 files changed, 0 insertions, 0 deletions