Index: gmap.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap.module,v
retrieving revision 1.93
diff -u -p -r1.93 gmap.module
--- gmap.module	19 Dec 2008 19:09:09 -0000	1.93
+++ gmap.module	23 Dec 2008 06:55:14 -0000
@@ -490,7 +490,7 @@ function gmap_menu() {
 /**
  * Regenerate the markerdata file.
  */
-function gmap_regenerate_markers() {
+function gmap_regenerate_markers($reset = FALSE) {
   $contents = '';
 
   // Create the js/ within the files folder.
@@ -499,9 +499,19 @@ function gmap_regenerate_markers() {
 
   $contents .= "// GMap marker image data.\n";
   $contents .= "Drupal.gmap.iconpath = ". drupal_to_js(base_path() . drupal_get_path('module', 'gmap') .'/markers') .";\n";
-  $contents .= "Drupal.gmap.icondata = ". drupal_to_js(gmap_get_icondata()) .";\n";
+  $contents .= "Drupal.gmap.icondata = ". drupal_to_js(gmap_get_icondata($reset)) .";\n";
 
   file_save_data($contents, "$jspath/gmap_markers.js", FILE_EXISTS_REPLACE);
+
+  // Also regenerate the cached marker titles array
+  gmap_get_marker_titles($reset);
+}
+
+/**
+ * Implementation of hook_flush_caches().
+ */
+function gmap_flush_caches() {
+  gmap_regenerate_markers(TRUE);
 }
 
 /**
@@ -973,19 +983,23 @@ function gmap_get_auto_mapid() {
  */
 function gmap_get_marker_titles($reset = FALSE) {
   static $titles;
-  if (is_array($titles) && !$reset) {
-    return $titles;
-  }
 
-  $titles = cache_get('gmap_marker_titles');
-  if ($titles) {
-    $titles = $titles->data;
-  }
+  if (!reset) {
+    if (is_array($titles)) {
+      return $titles;
+    }
 
-  if ($reset || !$titles) {
-    require_once(drupal_get_path('module', 'gmap') .'/gmap_markerinfo.inc');
-    $titles = _gmap_get_marker_titles();
+    $cached = cache_get('gmap_marker_titles', 'cache');
+    if (!empty($cached)) {
+      $titles = $cached->data;
+      if (is_array($titles)) {
+        return $titles;
+      }
+    }
   }
+
+  require_once(drupal_get_path('module', 'gmap') .'/gmap_markerinfo.inc');
+  $titles = _gmap_get_marker_titles();
   cache_set('gmap_marker_titles', $titles, 'cache');
   return $titles;
 }
Index: gmap_settings_ui.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap_settings_ui.inc,v
retrieving revision 1.10
diff -u -p -r1.10 gmap_settings_ui.inc
--- gmap_settings_ui.inc	29 Oct 2008 17:39:41 -0000	1.10
+++ gmap_settings_ui.inc	23 Dec 2008 05:36:36 -0000
@@ -445,6 +445,6 @@ function gmap_admin_settings_validate($f
  * Rebuild marker js.
  */
 function _gmap_rebuild_marker_js_submit($form, &$form_state) {
-  gmap_regenerate_markers();
+  gmap_regenerate_markers(TRUE);
   drupal_set_message(t('Marker cache regenerated.'));
 }
