summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2006-05-21 20:36:01 +0000
committermental <mental@users.sourceforge.net>2006-05-21 20:36:01 +0000
commit3c2f8189a5e834c1f2aa53230da69b97e3171e81 (patch)
treedbe4a4990e825f065273954e6aaaaefd994cd736 /src
parentremove unnecessary casts which didn't compile on old versions of FreeType (diff)
downloadinkscape-3c2f8189a5e834c1f2aa53230da69b97e3171e81.tar.gz
inkscape-3c2f8189a5e834c1f2aa53230da69b97e3171e81.zip
call GC::request_early_collection() after switching preview images
(bzr r923)
Diffstat (limited to 'src')
-rw-r--r--src/dialogs/filedialog.cpp7
-rw-r--r--src/gc-core.h2
-rw-r--r--src/gc.cpp22
3 files changed, 29 insertions, 2 deletions
diff --git a/src/dialogs/filedialog.cpp b/src/dialogs/filedialog.cpp
index bf9eaceb5..fb6e599a8 100644
--- a/src/dialogs/filedialog.cpp
+++ b/src/dialogs/filedialog.cpp
@@ -45,6 +45,7 @@
#include "inkscape.h"
#include "svg-view-widget.h"
#include "filedialog.h"
+#include "gc-core.h"
#undef INK_DUMP_FILENAME_CONV
@@ -175,6 +176,8 @@ bool SVGPreview::setFromMem(char const *xmlBuffer)
sp_document_unref(doc);
+ Inkscape::GC::request_early_collection();
+
return true;
}
@@ -675,10 +678,8 @@ private:
void FileOpenDialogImpl::updatePreviewCallback()
{
Glib::ustring fileName = get_preview_filename();
-
if (fileName.length() < 1)
return;
-
svgPreview.set(fileName, dialogType);
}
@@ -897,6 +898,7 @@ FileOpenDialogImpl::show()
set_modal (TRUE); //Window
sp_transientize((GtkWidget *)gobj()); //Make transient
gint b = run(); //Dialog
+ svgPreview.showNoPreview();
hide();
if (b == Gtk::RESPONSE_OK)
@@ -1344,6 +1346,7 @@ FileSaveDialogImpl::show()
set_modal (TRUE); //Window
sp_transientize((GtkWidget *)gobj()); //Make transient
gint b = run(); //Dialog
+ svgPreview.showNoPreview();
hide();
if (b == Gtk::RESPONSE_OK)
diff --git a/src/gc-core.h b/src/gc-core.h
index cec617d42..faf7eb4de 100644
--- a/src/gc-core.h
+++ b/src/gc-core.h
@@ -128,6 +128,8 @@ inline void init() {
Core::init();
}
+void request_early_collection();
+
}
}
diff --git a/src/gc.cpp b/src/gc.cpp
index 7333b4641..8d89de26a 100644
--- a/src/gc.cpp
+++ b/src/gc.cpp
@@ -12,6 +12,8 @@
#include "gc-core.h"
#include <stdexcept>
#include <glib/gmessages.h>
+#include <sigc++/functors/ptr_fun.h>
+#include <glibmm/main.h>
namespace Inkscape {
namespace GC {
@@ -264,6 +266,26 @@ void Core::init() {
_ops.do_init();
}
+
+namespace {
+
+bool collection_requested=false;
+bool collection_task() {
+ Core::gcollect();
+ Core::gcollect();
+ collection_requested=false;
+ return false;
+}
+
+}
+
+void request_early_collection() {
+ if (!collection_requested) {
+ collection_requested=true;
+ Glib::signal_idle().connect(sigc::ptr_fun(&collection_task));
+ }
+}
+
}
}