void refreshPreviews();
/// Emit this signal when an image is ready for display.
- signals2::signal<void(PreviewImage const &)> imageReady;
+ signal<void(PreviewImage const &)> imageReady;
Buffer const & buffer() const { return buffer_; }
///
QTimer * delay_refresh_;
///
- Trackable trackable_;
- ///
bool finished_generating_;
/// We don't own this
//
PreviewLoader::PreviewLoader(Buffer const & b)
- : pimpl_(new Impl(*this, b))
+ : pimpl_(make_shared<Impl>(*this, b))
{}
-PreviewLoader::~PreviewLoader()
-{
- delete pimpl_;
-}
-
-
PreviewImage const * PreviewLoader::preview(string const & latex_snippet) const
{
return pimpl_->preview(latex_snippet);
}
-signals2::connection PreviewLoader::connect(slot const & slot) const
+connection PreviewLoader::connect(slot const & slot) const
{
return pimpl_->imageReady.connect(slot);
}
// Initiate the conversion from LaTeX to bitmap images files.
ForkedCall::sigPtr convert_ptr = make_shared<ForkedCall::sig>();
- convert_ptr->connect(ForkedProcess::slot([this](pid_t pid, int retval){
- finishedGenerating(pid, retval);
- }).track_foreign(trackable_.p()));
+ weak_ptr<PreviewLoader::Impl> this_ = parent_.pimpl_;
+ convert_ptr->connect([this_](pid_t pid, int retval){
+ if (auto p = this_.lock()) {
+ p->finishedGenerating(pid, retval);
+ }
+ });
ForkedCall call(buffer_.filePath());
int ret = call.startScript(command, convert_ptr);
buffer_.writeLaTeXSource(os, buffer_.filePath(), runparams, Buffer::OnlyPreamble);
// FIXME! This is a HACK! The proper fix is to control the 'true'
- // passed to WriteStream below:
+ // passed to TeXMathStream below:
// int InsetMathNest::latex(Buffer const &, odocstream & os,
// OutputParams const & runparams) const
// {
- // WriteStream wi(os, runparams.moving_arg, true);
+ // TeXMathStream wi(os, runparams.moving_arg, true);
// par_->write(wi);
// return wi.line();
// }