Baruch, please have a look on this patc and tell me if you understand
why I made those changes:
Index: GraphicsCache.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/GraphicsCache.C,v
retrieving revision 1.1
diff -u -u -r1.1 GraphicsCache.C
--- GraphicsCache.C 2000/07/31 12:30:09 1.1
+++ GraphicsCache.C 2000/07/31 16:29:20
@@ -9,13 +9,18 @@
* This file Copyright 2000 Baruch Even
* ================================================= */
+#include <config.h>
+
#ifdef __GNUG__
#pragma implementation
#endif
-#include <config.h>
#include "GraphicsCache.h"
+
+GraphicsCache * GraphicsCache::singleton = 0;
+
+
GraphicsCache *
GraphicsCache::getInstance()
{
@@ -27,8 +32,14 @@
}
+GraphicsCache::~GraphicsCache()
+{
+ delete singleton;
+}
+
+
GraphicsCacheItem *
-GraphicsCache::addFile(string filename)
+GraphicsCache::addFile(string const & filename)
{
CacheType::const_iterator it = cache.find(filename);
@@ -39,8 +50,9 @@
return 0;
}
+
void
-GraphicsCache::removeFile(string filename)
+GraphicsCache::removeFile(string const & filename)
{
CacheType::const_iterator it = cache.find(filename);
Index: GraphicsCache.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/GraphicsCache.h,v
retrieving revision 1.1
diff -u -u -r1.1 GraphicsCache.h
--- GraphicsCache.h 2000/07/31 12:30:09 1.1
+++ GraphicsCache.h 2000/07/31 16:29:20
@@ -33,19 +33,17 @@
static GraphicsCache * getInstance();
/// Add a file to the cache.
- GraphicsCacheItem * addFile(string filename);
+ GraphicsCacheItem * addFile(string const & filename);
private:
/// Remove a cache item if it's count has gone to zero.
- void removeFile(string filename);
+ void removeFile(string const & filename);
/// Private c-tor so we can control how many objects are instantiated.
GraphicsCache() {}
/// Private d-tor so that no-one will destroy us.
- ~GraphicsCache() {
- delete singleton;
- }
+ ~GraphicsCache();
/// Holder of the single instance of the class.
static GraphicsCache * singleton;
@@ -53,7 +51,4 @@
typedef std::map<string, GraphicsCacheItem *> CacheType;
CacheType cache;
};
-
-GraphicsCache * GraphicsCache::singleton = 0;
-
#endif
Lgb