This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  a2328d9842b521cbeab4cb71afb9bea6c47dae86 (commit)
       via  1b2e8a6491029912cef34e24d6ae4e28083d71ef (commit)
       via  e237ec15a08e8203b51a5e18e4200936d32c7298 (commit)
       via  283286e0cd3dcc54157e9a84c9fd78fe136836bc (commit)
      from  64e401961449cfeaa72e3c8c5a4489da5abbabfd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/a2328d9842b521cbeab4cb71afb9bea6c47dae86

commit a2328d9842b521cbeab4cb71afb9bea6c47dae86
Author: Christophe CURIS <christophe.cu...@free.fr>
Date:   Fri May 9 09:45:27 2014 +0200

    WINGs: Fix crash on exit while trying to save user config changes
    
    Recent patches has introduced the ability to exit cleanly from the WINGs
    library, but this introduced some side effects because a function is
    registered with 'atexit' to save user config on exit, which may not work
    anymore because WMReleaseApplication frees some stuff needed for that task.
    
    This patch handles this so that both method works, in case user of the lib
    would forget to call the clean exit function.
    
    Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>

diff --git a/WINGs/Makefile.am b/WINGs/Makefile.am
index e70988de..863ba791 100644
--- a/WINGs/Makefile.am
+++ b/WINGs/Makefile.am
@@ -81,6 +81,7 @@ libWUtil_la_SOURCES =                 string.c        tree.c  
        userdefaults.c +        userdefaults.h          usleep.c        
wapplication.c          wconfig.h diff --git a/WINGs/userdefaults.c 
b/WINGs/userdefaults.c
index 160a08b6..876371d8 100644
--- a/WINGs/userdefaults.c
+++ b/WINGs/userdefaults.c
@@ -10,6 +10,9 @@
 #include "wconfig.h"
 
 #include "WINGs.h"
+#include "WINGsP.h"
+#include "userdefaults.h"
+
 
 typedef struct W_UserDefaults {
        WMPropList *defaults;
@@ -114,9 +117,19 @@ char *wglobaldefaultspathfordomain(const char *domain)
        return t;
 }
 
-static void
-saveDefaultsChanges(void)
+void w_save_defaults_changes(void)
 {
+       if (WMApplication.applicationName == NULL) {
+               /*
+                * This means that the user has properly exited by calling the
+                * function 'WMReleaseApplication' (which has already called us)
+                * but we're being called again by the fallback 'atexit' method
+                * (the legacy way of saving changes on exit which is kept for
+                * application that would forget to call 'WMReleaseApplication')
+                */
+               return;
+       }
+
        /* save the user defaults databases */
        synchronizeUserDefaults(NULL);
 }
@@ -127,7 +140,7 @@ static void registerSaveOnExit(void)
        static Bool registeredSaveOnExit = False;
 
        if (!registeredSaveOnExit) {
-               atexit(saveDefaultsChanges);
+               atexit(w_save_defaults_changes);
                registeredSaveOnExit = True;
        }
 }
diff --git a/WINGs/userdefaults.h b/WINGs/userdefaults.h
new file mode 100644
index 00000000..3e4b46bd
--- /dev/null
+++ b/WINGs/userdefaults.h
@@ -0,0 +1,34 @@
+/* WUtil / userdefaults.h
+ *
+ *  Copyright (c) 2014 Window Maker Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef WUTIL_USERDEFAULTS_H
+#define WUTIL_USERDEFAULTS_H
+
+/*
+ * This file is not part of WUtil public API
+ *
+ * It defines internal things for the user configuration handling functions
+ */
+
+
+/* Save user configuration, to be used when application exits only */
+void w_save_defaults_changes(void);
+
+
+#endif /* WUTIL_USERDEFAULTS_H */
diff --git a/WINGs/wapplication.c b/WINGs/wapplication.c
index beca03d9..1478ced9 100644
--- a/WINGs/wapplication.c
+++ b/WINGs/wapplication.c
@@ -4,6 +4,7 @@
 
 #include "WINGsP.h"
 #include "wconfig.h"
+#include "userdefaults.h"
 
 
 struct W_Application WMApplication;
@@ -51,6 +52,14 @@ void WMInitializeApplication(const char *applicationName, 
int *argc, char **argv
 void WMReleaseApplication(void) {
        int i;
 
+       /*
+        * We save the configuration on exit, this used to be handled
+        * through an 'atexit' registered function but if application
+        * properly calls WMReleaseApplication then the info to that
+        * will have been freed by us.
+        */
+       w_save_defaults_changes();
+
        W_ReleaseNotificationCenter();
 
        if (WMApplication.applicationName)

http://repo.or.cz/w/wmaker-crm.git/commit/1b2e8a6491029912cef34e24d6ae4e28083d71ef

commit 1b2e8a6491029912cef34e24d6ae4e28083d71ef
Author: David Maciejak <david.macie...@gmail.com>
Date:   Thu May 8 23:57:03 2014 +0200

    wrlib: Added clean-up of library internals in 'RShutdown'
    
    The library uses internally a cache of tables to convert image to different
    depths, there is now an internal function 'r_destroy_conversion_tables' to
    free them.

diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am
index d88ecc6c..3f229c53 100644
--- a/wrlib/Makefile.am
+++ b/wrlib/Makefile.am
@@ -28,6 +28,7 @@ libwraster_la_SOURCES =               save.c                  
gradient.c              xpixmap.c       +       convert.h               
convert.c               context.c               misc.c          diff --git 
a/wrlib/convert.c b/wrlib/convert.c
index f3c9a49d..95a14d45 100644
--- a/wrlib/convert.c
+++ b/wrlib/convert.c
@@ -34,6 +34,8 @@
 #include <assert.h>
 
 #include "wraster.h"
+#include "convert.h"
+
 
 #ifdef USE_XSHM
 extern Pixmap R_CreateXImageMappedPixmap(RContext * context, RXImage * ximage);
@@ -62,6 +64,38 @@ typedef struct RStdConversionTable {
 static RConversionTable *conversionTable = NULL;
 static RStdConversionTable *stdConversionTable = NULL;
 
+static void release_conversion_table(void)
+{
+       RConversionTable *tmp = conversionTable;
+
+       while (tmp) {
+               RConversionTable *tmp_to_delete = tmp;
+
+               tmp = tmp->next;
+               free(tmp_to_delete);
+       }
+       conversionTable = NULL;
+}
+
+static void release_std_conversion_table(void)
+{
+       RStdConversionTable *tmp = stdConversionTable;
+
+       while (tmp) {
+               RStdConversionTable *tmp_to_delete = tmp;
+
+               tmp = tmp->next;
+               free(tmp_to_delete);
+       }
+       stdConversionTable = NULL;
+}
+
+void r_destroy_conversion_tables(void)
+{
+       release_conversion_table();
+       release_std_conversion_table();
+}
+
 static unsigned short *computeTable(unsigned short mask)
 {
        RConversionTable *tmp = conversionTable;
diff --git a/wrlib/convert.h b/wrlib/convert.h
new file mode 100644
index 00000000..a3045e01
--- /dev/null
+++ b/wrlib/convert.h
@@ -0,0 +1,39 @@
+/*
+ * Raster graphics library
+ *
+ * Copyright (c) 2014 Window Maker Team
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *  MA 02110-1301, USA.
+ */
+
+/*
+ * Functions to convert images to given color depths
+ *
+ * The functions here are for WRaster library's internal use only,
+ * Please use functions in 'wraster.h' in applications
+ */
+
+#ifndef WRASTER_CONVERT_H
+#define WRASTER_CONVERT_H
+
+
+/*
+ * Function for to release internal Conversion Tables
+ */
+void r_destroy_conversion_tables(void);
+
+
+#endif
diff --git a/wrlib/misc.c b/wrlib/misc.c
index 53d5aaae..615777e1 100644
--- a/wrlib/misc.c
+++ b/wrlib/misc.c
@@ -27,6 +27,7 @@
 
 #include "wraster.h"
 #include "imgformat.h"
+#include "convert.h"
 
 
 void RBevelImage(RImage * image, int bevel_type)
@@ -252,4 +253,5 @@ void RShutdown(void)
        RReleaseMagick();
 #endif
        RReleaseCache();
+       r_destroy_conversion_tables();
 }

http://repo.or.cz/w/wmaker-crm.git/commit/e237ec15a08e8203b51a5e18e4200936d32c7298

commit e237ec15a08e8203b51a5e18e4200936d32c7298
Author: David Maciejak <david.macie...@gmail.com>
Date:   Thu May 8 23:57:02 2014 +0200

    wrlib: Added clean-up of image cache in 'RShutdown'
    
    The library maintains a cache of the images loaded, which is now
    emptyed when the lib is asked to shutdown.

diff --git a/wrlib/imgformat.h b/wrlib/imgformat.h
index 004da308..6bb0610a 100644
--- a/wrlib/imgformat.h
+++ b/wrlib/imgformat.h
@@ -85,4 +85,10 @@ void RReleaseMagick(void);
 Bool RSaveXPM(RImage *image, const char *file);
 
 
+/*
+ * Function to terminate properly
+ */
+void RReleaseCache(void);
+
+
 #endif
diff --git a/wrlib/load.c b/wrlib/load.c
index 44750708..7c2e6af7 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -129,6 +129,23 @@ static void init_cache(void)
        }
 }
 
+void RReleaseCache(void)
+{
+       int i;
+
+       if (RImageCacheSize > 0) {
+               for (i = 0; i < RImageCacheSize; i++) {
+                       if (RImageCache[i].file) {
+                               RReleaseImage(RImageCache[i].image);
+                               free(RImageCache[i].file);
+                       }
+               }
+               free(RImageCache);
+               RImageCache = NULL;
+               RImageCacheSize = -1;
+       }
+}
+
 RImage *RLoadImage(RContext * context, const char *file, int index)
 {
        RImage *image = NULL;
diff --git a/wrlib/misc.c b/wrlib/misc.c
index 00a7c576..53d5aaae 100644
--- a/wrlib/misc.c
+++ b/wrlib/misc.c
@@ -251,4 +251,5 @@ void RShutdown(void)
 #ifdef USE_MAGICK
        RReleaseMagick();
 #endif
+       RReleaseCache();
 }

http://repo.or.cz/w/wmaker-crm.git/commit/283286e0cd3dcc54157e9a84c9fd78fe136836bc

commit 283286e0cd3dcc54157e9a84c9fd78fe136836bc
Author: David Maciejak <david.macie...@gmail.com>
Date:   Thu May 8 23:57:01 2014 +0200

    wrlib: Implemented functions to allow clean-up of Contexts
    
    The function 'RDestroyContext' have been defined in the API for a long time
    but did not have an implementation, this patch fixes it.

diff --git a/wrlib/context.c b/wrlib/context.c
index b6794d08..74790092 100644
--- a/wrlib/context.c
+++ b/wrlib/context.c
@@ -688,6 +688,21 @@ RContext *RCreateContext(Display * dpy, int screen_number, 
const RContextAttribu
        return context;
 }
 
+void RDestroyContext(RContext *context)
+{
+       if (context) {
+               if (context->copy_gc)
+                       XFreeGC(context->dpy, context->copy_gc);
+               if (context->attribs) {
+                       if ((context->attribs->flags & RC_VisualID) &&
+                           !(context->attribs->flags & RC_DefaultVisual))
+                               XDestroyWindow(context->dpy, context->drawable);
+                       free(context->attribs);
+               }
+               free(context);
+       }
+}
+
 static Bool bestContext(Display * dpy, int screen_number, RContext * context)
 {
        XVisualInfo *vinfo = NULL, rvinfo;
diff --git a/wrlib/libwraster.map b/wrlib/libwraster.map
index 6e165ef0..422af756 100644
--- a/wrlib/libwraster.map
+++ b/wrlib/libwraster.map
@@ -33,6 +33,7 @@ LIBWRASTER3
     RConvertImageMask;
     RCopyArea;
     RCreateContext;
+    RDestroyContext;
     RCreateImage;
     RCreateImageFromDrawable;
     RCreateImageFromXImage;

-----------------------------------------------------------------------

Summary of changes:
 WINGs/Makefile.am                 |    1 +
 WINGs/userdefaults.c              |   19 ++++++++++++++++---
 WINGs/{error.h => userdefaults.h} |   16 +++++++---------
 WINGs/wapplication.c              |    9 +++++++++
 wrlib/Makefile.am                 |    1 +
 wrlib/context.c                   |   15 +++++++++++++++
 wrlib/convert.c                   |   34 ++++++++++++++++++++++++++++++++++
 util/common.h => wrlib/convert.h  |   22 ++++++++++++++--------
 wrlib/imgformat.h                 |    6 ++++++
 wrlib/libwraster.map              |    1 +
 wrlib/load.c                      |   17 +++++++++++++++++
 wrlib/misc.c                      |    3 +++
 12 files changed, 124 insertions(+), 20 deletions(-)
 copy WINGs/{error.h => userdefaults.h} (73%)
 copy util/common.h => wrlib/convert.h (66%)


repo.or.cz automatic notification. Contact project admin crma...@gmail.com
if you want to unsubscribe, or site admin ad...@repo.or.cz if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to