Now the wsd docbroker thread and its peer kit
thread are trivial to match, since they are called
docbroker_xxx and kitbroker_xxx (where xxx is the
instance ID) respectively.
Also, label spare kit instances as kit_spare_xxx
to differentiate from ones with actual documents,
where xxx is a running counter to differentiate
spare instances from one another.
Now we are able to easily see (and count) the number
of spare kit instances, and match wsd and kit threads
handling a given document.
Unit-test logic updated to reflect the new thread
naming scheme.
Change-Id: I154dc8f200fbe0e65f3f5984e6dad2cef1b52e22
Reviewed-on: https://gerrit.libreoffice.org/79328
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
For now, add an entry "Save as PDF" to the File menu in the iOS app.
Handle in an iOS-specific way in ChildSession::downloadAs(). The PDF
is saved in the app's document directory on the device. The name of
the PDF is the basename of the document being edited with the "pdf"
extension.
Change-Id: Ib0059a86b03b978996eb4cadf230ba7f0abcba62
Reviewed-on: https://gerrit.libreoffice.org/77961
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
Better hashing algorithm based on FNV-1a.
Adds support for salting the hash, and
for providing salt via configuration.
More unit-tests added, and better formatting.
Change-Id: I2be42675d0cdbaa73c3d7faed99e07631a9c20fc
Reviewed-on: https://gerrit.libreoffice.org/70034
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71091
This simplifies the anonymization configuration
as virtually always they are all either enabled
together, or not at all.
Change-Id: I6fe60f5287fc5d71cd7a6ac3268eac67e5e6e9fb
Reviewed-on: https://gerrit.libreoffice.org/70033
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71090
Also, avoid repeatedly converting INT_MAX to string.
It's an arbitrary large number, so use 1 billion,
which is probably more easily recognizable as an
arbitrary large number.
Change-Id: Ie6f898d6e8978efa29c355f3cb50b60114870f0d
Reviewed-on: https://gerrit.libreoffice.org/77593
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Finally unit-copy-paste passes under sanitizers with this. Details:
==8988==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d0005e6de0 at pc 0x000000988e85 bp 0x7fff753316d0 sp 0x7fff753316c8
READ of size 4 at 0x60d0005e6de0 thread T0 (loolkit)
#0 0x988e84 in std::pair<int const, UserInfo>::pair(std::pair<int const, UserInfo> const&) /home/vmiklos/git/libreoffice/lode/opt_private/gcc-7.3.0/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_pair.h:292:17
...
#12 0x9322af in Document::notifyViewInfo() /home/vmiklos/git/libreoffice/online-san/kit/Kit.cpp:1600:53
#13 0x9303f9 in Document::onUnload(ChildSession const&) /home/vmiklos/git/libreoffice/online-san/kit/Kit.cpp:1566:13
#14 0x616dcd in ChildSession::disconnect() /home/vmiklos/git/libreoffice/online-san/kit/ChildSession.cpp:96:25
#15 0x616535 in ChildSession::~ChildSession() /home/vmiklos/git/libreoffice/online-san/kit/ChildSession.cpp:85:5
freed by thread T0 (loolkit) here:
#0 0x60f9b0 in operator delete(void*) _asan_rtl_:0
...
#8 0x939292 in Document::~Document() /home/vmiklos/git/libreoffice/online-san/kit/Kit.cpp:913:5
I.e. when the Document dtor clears Document::_sessions, the ChildSession
dtor may be called. But ChildSession expected that it has a valid
Document during its lifetime, which is not a promise we can hold, see
the above trace.
Fix the problem by having a pointer (and not a reference) to a Document
in ChildSession and then:
1) Clear that Document pointer in ChildSessions at the end of the
Document dtor using a new resetDocManager()
2) Check if the Document is nullptr in ChildSession::disconnect()
instead of dereferencing it unconditionally.
Change-Id: I19d3d6bfe9e142a52c199f49aaa347d1a2edbf87
This adds table markers for resizing rows and columns if the user
has the table selected or the cursor is in the table. The code
reacts to the callback "tableselected:", where the markers are
created for each column and row, if the payload (json) of course
has any data. When the marker is dragged, a uno command to resize
the table column or row border is send to the core.
Change-Id: I9b21d09639c1b2be70a1a897f9e3340b453d847e
Reviewed-on: https://gerrit.libreoffice.org/77360
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Otherwise both loolwsd and unit-copy-paste.so would have a
SigHandlerTrap:
==26186==ERROR: AddressSanitizer: odr-violation (0x000002090ae0):
[1] size=40 'SigHandlerTrap' ../common/SigUtil.cpp:76:12
[2] size=40 'SigHandlerTrap' common/SigUtil.cpp:76:12
These globals were registered at these points:
[1]:
#0 0x5f9a28 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
#1 0x7f8f537f1d8b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ad8b)
[2]:
#0 0x5f9a28 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
#1 0xe2bcfe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2bcfe)
Change-Id: I54d5f6d4298848cacd437d302cff0e8c5003fb8c
Otherwise both loolwsd and unit-copy-paste.so would have a
TerminationFlag:
==11732==ERROR: AddressSanitizer: odr-violation (0x00000208f4a0):
[1] size=1 'TerminationFlag' ../common/SigUtil.cpp:41:19
[2] size=1 'TerminationFlag' common/SigUtil.cpp:41:19
These globals were registered at these points:
[1]:
#0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
#1 0x7f5df9cf18cb in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60a8cb)
[2]:
#0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
#1 0xe2b4fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b4fe)
Change-Id: Ic620b143ecb77699f40676ff39d0fa7abceb34d5
Improve on handling paste without download and
handles onerror properly, which invokes the error
handler callback (where provided) where previously
it was ignored.
Change-Id: I3b527516dc4f90484fd1cfba411b45ff948ffc53
re-factor ClientSession state to be a simpler state machine.
Have a nice disconnect / disconnected handshake on view close.
Change-Id: Ie933cc5c7dfab46c66f4d38a4d75c459aa1cff87
Complex data is now flagged based on Core's
feedback and/or the size of the payload.
Download now works as expected and copying
to the clipboard is also functional.
Change-Id: I7405517e3a6afcc4c8f5843130476578c1ff06f6
This replaces the standard text selection marker with a cell
selection markers to resize the cell selection. This looks and
behaves better for cells in Calc and it is also easier to deal
with.
Additionally add auto fill marker to perform the auto fill action
on the cells. This was not possible to do previously unless you
hit an invisible part of the cell selection, which is not
convenient when using touch.
Change-Id: Ia02d03b7b8e8d98412ea98eb92fb47d1505ef979
Reviewed-on: https://gerrit.libreoffice.org/76494
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
We currently combine only horizontally, but ctrl-right arrow in
calc can throw us to the other side of the sheet, creating a very
large area to re-render.
Change-Id: I7125ab815e3de1296b3af32632626005eeee0ec9
Otherwise, it causes error log:
ERR Cannot save docKey [/filename], the .uno:Save has failed in LOK.
Change-Id: Ic99807848def72f76471c4f999ebeed9a7c0a2c8
Now with the "Unipoll" concept all this locking is unnecessary as the
kit process is single-threaded, and actually it is harmful as the bug
shows.
Michael explains in chat:
But in fact - we should be a single threaded kit process there now. We
are protected by the solar-mutex (which is recursive) while our
locking is not. This was the whole point of the Unipoll refactor: to
remove the extra threads, complex queues, etc. etc. I just left the
mutexes. Even a recursive mutex won't work there; since it needs to be
drop-able and transferable to another (LOK internal thread) in Yield,
so - we should remove them.
Change-Id: I7d1e1dfb0e20f14134be5f81da057539b0f86ab9
Reviewed-on: https://gerrit.libreoffice.org/75849
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Document has to be final: its constructor calls sendTextFrame(), which
calls the virtual sendFrame(). So the only situation where this code
works correctly is when Document is never subclassed.
Change-Id: I7c13abdae57d9e1ba3416ec1963b58bce0d42e6f
For some operations like printing to PDF, we need to have access to the
LOK API to perform eg. saveAs(). iOS is using an extern for that, but
given that it is needed for Android too, let's introduce a proper getter
for that.
Change-Id: Ie2340a4ee0bdf9dc46e799e2567a828172d9a67d
This is needed to compile the tests without undefined references when
using sanitizers. Previously it was possible to run loolwsd, but
building the tests failed.
Change-Id: I6babd1c43816cb2387c82316cc1bf9ff14d7a068
The process never exists voluntarily. It is killed by the OS when
inactive and its resources are needed.
Change-Id: I9a7fa8200a44bba8dfcd2b09882f1b87814025be
kit/Kit.cpp:2166:17: error: private field '_socketPoll' is not used [-Werror,-Wunused-private-field]
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../include/c++/7/ext/new_allocator.h:140:22: error: destructor called on non-final 'Document' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-abstract-non-virtual-dtor]
Change-Id: I47849db2b0bc64e811577e3a8cede0e2d2c0e2e6
Wakeup wakes up the nested SocketPoll::poll nicely, but that's no
use if we immediately ignore that and re-poll, so shorten the
timeout in this case.
Change-Id: I927d2375b92c9ce6c6ebe3f0ab33e2863894e2ef
This uses the new createViewWithOptions API to
set the language of the user at the point of
creating a new view.
Change-Id: Ibf3e0af1b0cc300126388c1217692d8d969be0f3
Reviewed-on: https://gerrit.libreoffice.org/67501
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Moves appending tokens into the serializer and
avoids making extra copies of itself.
Change-Id: I62d374e69d9c4a55643ea20cb5f8c2b9c75c88c5
Reviewed-on: https://gerrit.libreoffice.org/71022
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Unfortunately processing multiple events from the Kit socket
is causing massive document invalidations, for unknown
reasons. As such, for now we have to process one event
at a time, until the source of the invalidations is found
and fixed.
Without the invalidation, the average tile rendering
roundtrip is about 3x faster than with the invalidations
and the maximum roundrip is at least 2x faster.
Change-Id: Iafbf9ccc2b80656cb71c208b598080f72d201ca2
Reviewed-on: https://gerrit.libreoffice.org/70906
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Remove redundant _id member from TileCombined, add constructor
from TileDesc, and use it to shrink the code.
Change-Id: Idc0ded63166ed350ab81b07e191b7a60d4407cd4
Unix Domain Sockets are inaddressable remotely, and more efficient,
as well as allowing future SCM_CREDENTIALS / SCM_RIGHTS.
Change-Id: Ia2472260f75feb43e9022cdfa0fe005ccd489454
Pan gesture should work for comboboxes, for which panning is
implemented in core.
Change-Id: I0a7e49e9335159a302716f666e2334a9d532c115
Reviewed-on: https://gerrit.libreoffice.org/69720
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
The lok_document pointer will only be used when it is valid anyway.
Fixes a crash when you open a second document after closing the first.
Change-Id: I362db282e4eccf419b56bf790ea58181594ab0fe
PDF export, signing and upload needs to be done in one operation
as PDF doesn't change the current document. The workflow is just
a bit different to the ODF / OOXML that it needs a change in
behaviour.
Change-Id: I752b293494a2d677fa7f12f2317954cfcf47859b
So copy it from the lotemplate.
Change-Id: I84d1514e5e06ec194e549b36f8db2dc6fdd04f38
(cherry picked from commit 66dcff38a7248fb7facc6d459ac8788882262bb1)
Reviewed-on: https://gerrit.libreoffice.org/65018
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Unfortuantely it still fails, but this is not regression. Now
with the new patch in Core the exception is caught and so at least
the binary survives (and the API returns 0).
New unit-test added in Core to help track the issue down and fix.
Also, free the memory allocated by the API.
Change-Id: I5d788a2ee0383de1c323af4cd6b39b8615a35baf
This shows what the current document status is in the signing
infobar.
When logging in into vereign we need to check the current document
as we have all the needed certificates avaliable.
Change-Id: I7fb4420d0b80a6d0fa553fca2f0be7b6dec6249f
Reviewed-on: https://gerrit.libreoffice.org/64333
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Save document to a input format (either PDF, ODT, DOCX) and send
the document to Vereign using WOPI protocol.
Change-Id: If9a7d88e91d07c7f1f831c01793f0f73d7a98131
Reviewed-on: https://gerrit.libreoffice.org/63839
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>