diff --git a/src/Lib/Ass/Line.cc b/src/Lib/Ass/Line.cc index 1bebb0bca2cd3e195eddd9611b6005d09a0156d1..756f6c47f44820d1fbbe464168473662abb4d1d9 100644 --- a/src/Lib/Ass/Line.cc +++ b/src/Lib/Ass/Line.cc @@ -7,6 +7,7 @@ using namespace Vivy::Ass; Line::Line() + // FIXME SEVERE: use of currentVivyDocument? : assFactory(currentVivyDocument->getAssSubDocument()->getFactory()) { } diff --git a/src/UI/DocumentViews/AudioVisualizer/TimingScene.cc b/src/UI/DocumentViews/AudioVisualizer/TimingScene.cc index 3aee8bbcb7bb9c2cb66e05a5e615473335026e8e..dcca1fb176d7d9b4f8a0e02baeaa9030ad1ad71c 100644 --- a/src/UI/DocumentViews/AudioVisualizer/TimingScene.cc +++ b/src/UI/DocumentViews/AudioVisualizer/TimingScene.cc @@ -81,18 +81,25 @@ TimingScene::rebuildScene() addItem(cursor); cursor->setPos(0, TimingUtils::axisHeight()); - if (auto assDocument = currentVivyDocument->getAssSubDocument()) { - QVector<Ass::LinePtr> lines = assDocument->getLines(); - for (int i = 0; i < lines.size(); ++i) { - if (auto line = lines.at(i).get()) { - TimingLine *l = new TimingLine(line, i); - l->setVisible(false); - addItem(l); - timingLines.append(l); - if (auto p = rootView.lock()) { - if (auto assLinesModel = p->getAssLinesModel()) { - connect(l, &TimingLine::lineChanged, assLinesModel, - &AssLinesModel::updateLine); + // FIXME: bruh + if (auto p = rootView.lock()) { + if (auto v = p.get()) { + if (auto d = v->getDocument()) { + if (auto assDocument = d->getAssSubDocument()) { + QVector<Ass::LinePtr> lines = assDocument->getLines(); + for (int i = 0; i < lines.size(); ++i) { + if (auto line = lines.at(i).get()) { + TimingLine *l = new TimingLine(line, i); + l->setVisible(false); + addItem(l); + timingLines.append(l); + if (auto p = rootView.lock()) { + if (auto assLinesModel = p->getAssLinesModel()) { + connect(l, &TimingLine::lineChanged, assLinesModel, + &AssLinesModel::updateLine); + } + } + } } } } diff --git a/src/VivyApplication.hh b/src/VivyApplication.hh index c802a011f505188c8dba07815c80a4c15e80f0d7..e516b3e0aecd9a952c7537c8ff2cf0ffc80e07ac 100644 --- a/src/VivyApplication.hh +++ b/src/VivyApplication.hh @@ -16,6 +16,12 @@ #define VIVY_APP_LOGGABLE_OBJECT_BY_STORED_NAME(name, logger) \ VIVY_LOGGABLE_OBJECT_BY_STORED_NAME(vivyApp->getLogSink(), name, logger) +/* + * Be careful when using those two macros + * What you get here is the document currently selected as the current tab + * Fore exemple, there is no guarantee that this is the same document that + * the parent of a subDocument View you're calling those macros from + */ #define currentVivyDocument dynamic_cast<VivyDocument *>(vivyApp->getCurrentDocument()) #define currentScriptDocument dynamic_cast<ScriptDocument *>(vivyApp->getCurrentDocument())