1
0
mirror of https://github.com/aseprite/aseprite.git synced 2025-03-22 10:20:53 +00:00

We cannot create a ContextReader in the filter background thread

This is because ContextReader gets the activeSite, which (in case of
the UIContext) asks to the UI thread this information (app::Editor).
This commit is contained in:
David Capello 2019-07-26 12:06:21 -03:00
parent f248d8ed65
commit b5547251f5
3 changed files with 7 additions and 6 deletions

@ -50,8 +50,8 @@ using namespace std;
using namespace ui;
FilterManagerImpl::FilterManagerImpl(Context* context, Filter* filter)
: m_context(context)
, m_site(context->activeSite())
: m_reader(context)
, m_site(*const_cast<Site*>(m_reader.site()))
, m_filter(filter)
, m_cel(nullptr)
, m_src(nullptr)
@ -281,8 +281,7 @@ void FilterManagerImpl::applyToTarget()
}
// Initialize writting operation
ContextReader reader(m_context);
ContextWriter writer(reader);
ContextWriter writer(m_reader);
m_tx.reset(new Tx(writer.context(), m_filter->getName(), ModifyDocument));
m_progressBase = 0.0f;

@ -10,6 +10,7 @@
#pragma once
#include "app/commands/filters/cels_target.h"
#include "app/context_access.h"
#include "app/site.h"
#include "app/tx.h"
#include "base/exception.h"
@ -139,8 +140,8 @@ namespace app {
void redrawColorPalette();
#endif
Context* m_context;
Site m_site;
ContextReader m_reader;
Site& m_site;
Filter* m_filter;
doc::Cel* m_cel;
doc::ImageRef m_src;

@ -12,6 +12,7 @@
#include "app/app.h"
#include "app/commands/filters/filter_manager_impl.h"
#include "app/console.h"
#include "app/context_access.h"
#include "app/i18n/strings.h"
#include "app/ini_file.h"
#include "app/modules/editors.h"