Merge branch 'm-bugfix' into dev

This commit is contained in:
Morgan Hardwood 2019-04-15 11:40:37 +02:00
commit fb4c5e1ce2
3 changed files with 17 additions and 1 deletions

View File

@ -120,6 +120,10 @@ void RTImage::changeImage (const Glib::ustring& imageName)
{ {
clear (); clear ();
if (imageName.empty()) {
return;
}
if (pixbuf) { if (pixbuf) {
auto iterator = pixbufCache.find (imageName); auto iterator = pixbufCache.find (imageName);
assert(iterator != pixbufCache.end ()); assert(iterator != pixbufCache.end ());
@ -169,6 +173,17 @@ void RTImage::init()
scaleBack = RTScalable::getScale(); scaleBack = RTScalable::getScale();
} }
void RTImage::cleanup()
{
for (auto& entry : pixbufCache) {
entry.second.reset();
}
for (auto& entry : surfaceCache) {
entry.second.clear();
}
RTScalable::cleanup();
}
void RTImage::updateImages() void RTImage::updateImages()
{ {
for (auto& entry : pixbufCache) { for (auto& entry : pixbufCache) {

View File

@ -52,6 +52,7 @@ public:
static void init(); static void init();
static void cleanup();
static void updateImages (); static void updateImages ();
static void setDPInScale (const double newDPI, const int newScale); static void setDPInScale (const double newDPI, const int newScale);
static void setScale (const int newScale); static void setScale (const int newScale);

View File

@ -463,7 +463,7 @@ RTWindow::~RTWindow()
delete fpanel; delete fpanel;
} }
RTScalable::cleanup(); RTImage::cleanup();
} }
void RTWindow::on_realize () void RTWindow::on_realize ()