Commit eb8c3ab0 authored by Murray Cumming's avatar Murray Cumming
Browse files

ImageGlom: Put EvView in ScrolledWindow to avoid crash.

Because recent versions of libevince-view have an assert that crashes
the application:
https://bugzilla.gnome.org/show_bug.cgi?id=761396#c12
parent ff960254
......@@ -48,7 +48,8 @@ ImageGlom::type_vec_ustrings ImageGlom::m_evince_supported_mime_types;
ImageGlom::type_vec_ustrings ImageGlom::m_gdkpixbuf_supported_mime_types;
ImageGlom::ImageGlom()
: m_ev_view(nullptr),
: m_ev_scrolled_window(nullptr),
m_ev_view(nullptr),
m_ev_document_model(nullptr)
{
init();
......@@ -56,6 +57,7 @@ ImageGlom::ImageGlom()
ImageGlom::ImageGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& /* builder */)
: Gtk::EventBox(cobject),
m_ev_scrolled_window(nullptr),
m_ev_view(nullptr),
m_ev_document_model(nullptr)
{
......@@ -64,7 +66,9 @@ ImageGlom::ImageGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>&
void ImageGlom::init()
{
//TODO: Don't instantiate this unnecessarily.
m_ev_view = EV_VIEW(ev_view_new());
//gtk_widget_add_events(GTK_WIDGET(m_ev_view), GDK_BUTTON_PRESS_MASK);
//Connect the the EvView's button-press-event signal,
......@@ -348,7 +352,16 @@ void ImageGlom::show_image_data()
m_image.hide();
gtk_widget_show(GTK_WIDGET(m_ev_view));
gtk_container_add(GTK_CONTAINER(m_frame.gobj()), GTK_WIDGET(m_ev_view));
if (!m_ev_scrolled_window)
{
m_ev_scrolled_window = Gtk::manage(new Gtk::ScrolledWindow());
m_ev_scrolled_window->show();
gtk_container_add(GTK_CONTAINER(m_ev_scrolled_window->gobj()), GTK_WIDGET(m_ev_view));
}
m_frame.add(*m_ev_scrolled_window);
// Try loading from data in memory:
// TODO: Uncomment this if this API is added: https://bugzilla.gnome.org/show_bug.cgi?id=654832
......
......@@ -28,6 +28,7 @@
#include "layoutwidgetfield.h"
#include <gtkmm/frame.h>
#include <gtkmm/builder.h>
#include <gtkmm/scrolledwindow.h>
#include <giomm/appinfo.h>
#include <giomm/simpleactiongroup.h>
#include <evince-view.h>
......@@ -108,6 +109,7 @@ private:
Gtk::Frame m_frame;
//For anything supported by Evince:
Gtk::ScrolledWindow* m_ev_scrolled_window;
EvView* m_ev_view;
EvDocumentModel* m_ev_document_model;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment