loolwsd: assign view id after loading

When session, it is not assigned, ViewCallback thread
will not enqueue the message
This commit is contained in:
Henry Castro 2016-09-17 17:52:54 -04:00
parent 722ca5daf5
commit 7243e485d0
3 changed files with 2 additions and 2 deletions

View file

@ -326,7 +326,6 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, StringT
if (_multiView)
{
std::ostringstream ossViewInfo;
_viewId = _loKitDocument->getView();
const auto viewId = std::to_string(_viewId);
// Create a message object

View file

@ -69,6 +69,7 @@ public:
bool getStatus(const char *buffer, int length);
bool getPartPageRectangles(const char *buffer, int length);
int getViewId() const { return _viewId; }
void setViewId(const int viewId) { _viewId = viewId; }
const std::string getViewUserName() const { return _userName; }
void loKitCallback(const int nType, const std::string& rPayload);

View file

@ -1175,7 +1175,7 @@ private:
if (_multiView)
{
viewId = _loKitDocument->getView();
session->setViewId((viewId = _loKitDocument->getView()));
_viewIdToCallbackDescr.emplace(viewId,
std::unique_ptr<CallbackDescriptor>(new CallbackDescriptor({ this, viewId })));
_loKitDocument->registerCallback(ViewCallback, _viewIdToCallbackDescr[viewId].get());