Merge pull request #818 from manongjohn/fix_style_management_studio_palette_crash

Fix Studio Palette Crash from Style Management change
This commit is contained in:
manongjohn 2021-10-20 07:29:05 -04:00 committed by GitHub
commit 82e1e80ad4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -4,7 +4,9 @@
#define STUDIOPALETTEVIEWER_H
#include "toonz/studiopalette.h"
#include "toonz/tapplication.h"
#include "toonz/tproject.h"
#include "toonzqt/paletteviewer.h"
#include "toonzqt/dvdialog.h"
#include <QTreeWidget>
@ -218,6 +220,8 @@ class DVAPI StudioPaletteViewer final : public QSplitter {
StudioPaletteTreeViewer *m_studioPaletteTreeViewer;
PaletteViewer *m_studioPaletteViewer;
TApplication *m_app;
public:
StudioPaletteViewer(QWidget *parent, TPaletteHandle *studioPaletteHandle,
TPaletteHandle *levelPaletteHandle,
@ -230,6 +234,12 @@ public:
int getViewMode() const;
void setViewMode(int mode);
void setApplication(TApplication *app) {
m_app = app;
if (m_studioPaletteViewer) m_studioPaletteViewer->setApplication(app);
}
TApplication *getApplication() { return m_app; }
};
//-----------------------------------------------------------------------------

View file

@ -699,6 +699,7 @@ StudioPaletteViewerPanel::StudioPaletteViewerPanel(QWidget *parent)
this, m_studioPaletteHandle,
app->getPaletteController()->getCurrentLevelPalette(),
app->getCurrentFrame(), app->getCurrentXsheet(), app->getCurrentLevel());
m_studioPaletteViewer->setApplication(app);
setWidget(m_studioPaletteViewer);
}

View file

@ -105,7 +105,8 @@ PaletteViewer::PaletteViewer(QWidget *parent, PaletteViewType viewType,
, m_lockPaletteAction(0)
, m_frozen(false)
, m_freezePaletteToolButton(0)
, m_lockPaletteToolButton(0) {
, m_lockPaletteToolButton(0)
, m_app(0) {
setObjectName("OnePixelMarginFrame");
setFrameStyle(QFrame::StyledPanel);
@ -871,7 +872,7 @@ void PaletteViewer::hideEvent(QHideEvent *) {
//-----------------------------------------------------------------------------
void PaletteViewer::enterEvent(QEvent *) {
getApplication()->getPaletteController()->setCurrentPaletteViewer(this);
if (m_app) m_app->getPaletteController()->setCurrentPaletteViewer(this);
}
//-----------------------------------------------------------------------------