]> git.sur5r.net Git - bacula/bacula/commitdiff
kes wx-console crashes because of differences between Bacula and wxWidgets
authorKern Sibbald <kern@sibbald.com>
Fri, 25 Aug 2006 12:35:45 +0000 (12:35 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 25 Aug 2006 12:35:45 +0000 (12:35 +0000)
     malloc()/free().  Tweek wx-console to use bmalloc()/bfree() for Bacula
     calls.
kes  correct improper indenting in wx-console/console_conf.c
kes  update wx-console header copyrights
kes  Fix bug #658 where wx-console mangles file/directory names containing
     commas.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3368 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/bacula.h
bacula/src/lib/bsys.c
bacula/src/lib/protos.h
bacula/technotes-1.39

index 9d49a63aee03a7597498450d7d1a4a16d8e4de8e..5619c0d7f2b041731c8f8d333bb22cfca28f0d96 100644 (file)
 #include "baconfig.h"
 #include "lib/lib.h"
 
+/*
+ * For wx-console compiles, we undo some Bacula defines.
+ *  This prevents conflicts between wx-Widgets and Bacula.
+ *  In wx-console files that malloc or free() Bacula structures
+ *  config/resources and interface to the Bacula libraries,
+ *  you must use bmalloc() and bfree().
+ */
 #ifdef HAVE_WXCONSOLE
 #undef New
 #undef _
+#undef free
+#undef malloc
 #endif
 
 #if defined(HAVE_WIN32)
index aa2be79c06b8cef4009eaa0a1c130e45d6b0c6bb..a4dc7231aabdb5f9e060da4c8806bbaa395a8405 100644 (file)
@@ -176,12 +176,16 @@ int cstrlen(const char *str)
 
 
 
-#ifndef DEBUG
+#ifndef bmalloc
 void *bmalloc(size_t size)
 {
   void *buf;
 
+#ifdef SMARTALLOC
+  buf = sm_malloc(file, line, size);
+#else
   buf = malloc(size);
+#endif
   if (buf == NULL) {
      berrno be;
      Emsg1(M_ABORT, 0, _("Out of memory: ERR=%s\n"), be.strerror());
@@ -207,6 +211,18 @@ void *b_malloc(const char *file, int line, size_t size)
 }
 
 
+void bfree(void *buf)
+{
+#ifdef SMARTALLOC
+  sm_free(__FILE__, __LINE__, buf);
+#else
+  free(buf);
+#endif
+}
+
+
+
+
 void *brealloc (void *buf, size_t size)
 {
    buf = realloc(buf, size);
index dc2a2d9de2082b9fec0a1b6bbc74254ab3465aa6..d0ddd5326e87ed1c8692b5371cd15b88b0a52d79 100644 (file)
@@ -42,9 +42,10 @@ char     *bstrncat               (char *dest, POOL_MEM &src, int maxlen);
 bool      bstrcmp                (const char *s1, const char *s2);
 int       cstrlen                (const char *str);
 void     *b_malloc               (const char *file, int line, size_t size);
-#ifndef DEBUG
+#ifndef bmalloc
 void     *bmalloc                (size_t size);
 #endif
+void      bfree                  (void *buf);
 void     *brealloc               (void *buf, size_t size);
 void     *bcalloc                (size_t size1, size_t size2);
 int       bsnprintf              (char *str, int32_t size, const char *format, ...);
index 60433e77e042d2212cd792212ff646e4f63fbf0f..ab1c6345f7a83d94a3da627689f5e3138bb9d8c0 100644 (file)
@@ -1,6 +1,14 @@
               Technical notes on version 1.39  
 
 General:
+25Aug06
+kes  wx-console crashes because of differences between Bacula and wxWidgets
+     malloc()/free().  Tweek wx-console to use bmalloc()/bfree() for Bacula
+     calls.     
+kes  correct improper indenting in wx-console/console_conf.c
+kes  update wx-console header copyrights
+kes  Fix bug #658 where wx-console mangles file/directory names containing
+     commas.
 24Aug06
 kes  Add Media.Enabled flag to client backups for dotcmds.c
 kes  Enforce Media.Enabled=1 for a current restore to work.