Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cool#11002 kit: fix memory corruption in Document::handleSaveMessage() #11007

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions kit/Kit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,16 @@ void Document::handleSaveMessage(const std::string &)
if (_queue)
_queue->clear();

// unregister the view callbacks
const int viewCount = getLOKitDocument()->getViewsCount();
std::vector<int> viewIds(viewCount);
getLOKitDocument()->getViewIds(viewIds.data(), viewCount);
for (const auto viewId : viewIds)
{
_loKitDocument->setView(viewId);
_loKitDocument->registerCallback(nullptr, nullptr);
}

// cleanup any lingering file-system pieces
_loKitDocument.reset();

Expand Down
7 changes: 7 additions & 0 deletions wsd/CacheUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ struct CacheQuery
std::string _uri;
std::string _stamp;
std::string _dest;

CacheQuery(const std::string& uri, const std::string& stamp, const std::string& dest)
: _uri(uri)
, _stamp(stamp)
, _dest(dest)
{
}
};

class Cache
Expand Down
Loading