Code

german translation update
[inkscape.git] / src / gc.cpp
index 7333b4641bd0b3e2bedda6d0a8664c8d9a1dfeaf..97350daffa4686080b112df5049363964a888ba8 100644 (file)
@@ -1,7 +1,7 @@
-/*
- * Inkscape::GC - Wrapper for Boehm GC
- *
- * Authors:
+/** @file
+ * @brief Wrapper for Boehm GC
+ */
+/* Authors:
  *   MenTaLguY <mental@rydia.net>
  *
  * Copyright (C) 2004 MenTaLguY
 
 #include "gc-core.h"
 #include <stdexcept>
+#include <cstring>
+#include <string>
 #include <glib/gmessages.h>
+#include <sigc++/functors/ptr_fun.h>
+#include <glibmm/main.h>
 
 namespace Inkscape {
 namespace GC {
@@ -87,7 +91,7 @@ void dummy_register_finalizer(void *, CleanupFunc, void *,
 
 int dummy_general_register_disappearing_link(void **, void *) { return false; }
 
-int dummy_unregister_disappearing_link(void **link) { return false; }
+int dummy_unregister_disappearing_link(void **/*link*/) { return false; }
 
 std::size_t dummy_get_heap_size() { return 0; }
 
@@ -264,6 +268,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));
+    }
+}
+
 }
 }
 
@@ -276,4 +300,4 @@ void Core::init() {
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :