gnome-commander r2504 - in trunk: . src



Author: epiotr
Date: Wed Apr  1 22:02:45 2009
New Revision: 2504
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2504&view=rev

Log:
regex: fix for g_regex_unref() assertion

Modified:
   trunk/ChangeLog
   trunk/src/gnome-cmd-regex.h

Modified: trunk/src/gnome-cmd-regex.h
==============================================================================
--- trunk/src/gnome-cmd-regex.h	(original)
+++ trunk/src/gnome-cmd-regex.h	Wed Apr  1 22:02:45 2009
@@ -88,8 +88,8 @@
         RegexFind(const gchar *from, gboolean case_sensitive);
         RegexFind(const std::string &from, gboolean case_sensitive);
 
-        void assign(const gchar *from, gboolean case_sensitive)           {  return Regex::assign(from, case_sensitive);   }
-        void assign(const std::string &from, gboolean case_sensitive)     {  return Regex::assign(from, case_sensitive);   }
+        void assign(const gchar *from, gboolean case_sensitive)           {  Regex::assign(from, case_sensitive);  }
+        void assign(const std::string &from, gboolean case_sensitive)     {  Regex::assign(from, case_sensitive);  }
         gboolean match(const gchar *s);
         gboolean match(const std::string &s) {  return match(s.c_str());  }
         int start() const;
@@ -104,7 +104,7 @@
         RegexReplace(const std::string &from, const std::string &to, gboolean case_sensitive): FindPattern(from,case_sensitive), ReplacePattern(from,to,case_sensitive), Regex(from,case_sensitive) {}
 
         void assign(const gchar *from, const gchar *to, gboolean case_sensitive);
-        void assign(const std::string &from, const std::string &to, gboolean case_sensitive)    {  replacement = to; return Regex::assign(from, case_sensitive);   }
+        void assign(const std::string &from, const std::string &to, gboolean case_sensitive)    {  replacement = to; Regex::assign(from, case_sensitive);   }
         gchar *replace(const gchar *s);
         gchar *replace(const std::string &s)    {  return replace(s.c_str());  }
     };
@@ -134,7 +134,8 @@
     inline void Regex::assign(const gchar *from, gboolean case_sensitive)
     {
 #if GLIB_CHECK_VERSION (2, 14, 0)
-        g_regex_unref (re);
+        if (re)
+            g_regex_unref (re);
 #else
         if (!malformed_pattern)  regfree(&re);
 #endif
@@ -151,7 +152,8 @@
     inline void Regex::assign(const std::string &from, gboolean case_sensitive)
     {
 #if GLIB_CHECK_VERSION (2, 14, 0)
-        g_regex_unref (re);
+        if (re)
+            g_regex_unref (re);
 #else
         if (!malformed_pattern)  regfree(&re);
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]