menu-cache-1.1.0-consolidated_fixes-1.patch 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. Submitted By: Pierre Labastie <pierre dot labastie at neuf dot fr>
  2. Date: 2020-05-19
  3. Initial Package Version: 1.1.0
  4. Upstream Status: First patch is committed, second submitted
  5. Origin: https://github.com/lxde/menu-cache
  6. Description: Fix a memory leak and multiple definitions
  7. From 97e5de8682c0c44fe4e6a2df864c5fdf76cd77cc Mon Sep 17 00:00:00 2001
  8. From: Palo Kisa <palo.kisa@gmail.com>
  9. Date: Thu, 30 Nov 2017 11:36:18 +0100
  10. Subject: [PATCH] libmenu-cache: Fix memory leaks
  11. ---
  12. libmenu-cache/menu-cache.c | 5 +++++
  13. 1 file changed, 5 insertions(+)
  14. diff --git a/libmenu-cache/menu-cache.c b/libmenu-cache/menu-cache.c
  15. index 5025d72..273b503 100644
  16. --- a/libmenu-cache/menu-cache.c
  17. +++ b/libmenu-cache/menu-cache.c
  18. @@ -379,11 +379,15 @@ static MenuCacheItem* read_item(GDataInputStream* f, MenuCache* cache,
  19. else /* separator */
  20. {
  21. item->type = MENU_CACHE_TYPE_SEP;
  22. + g_free(line);
  23. return item;
  24. }
  25. }
  26. else
  27. + {
  28. + g_free(line);
  29. return NULL;
  30. + }
  31. item->id = g_strndup( line + 1, len - 1 );
  32. g_free(line);
  33. @@ -923,6 +927,7 @@ gboolean menu_cache_item_unref(MenuCacheItem* item)
  34. else
  35. {
  36. MenuCacheApp* app = MENU_CACHE_APP(item);
  37. + g_free(app->generic_name);
  38. g_free( app->exec );
  39. g_free(app->try_exec);
  40. g_free(app->working_dir);
  41. From 1ce739649b4d66339a03fc0ec9ee7a2f7c141780 Mon Sep 17 00:00:00 2001
  42. From: Mamoru TASAKA <mtasaka@fedoraproject.org>
  43. Date: Fri, 24 Jan 2020 13:33:00 +0900
  44. Subject: [PATCH] Support gcc10 compilation
  45. gcc10 now defaults to -fno-common, and with gcc10 menu-cache compilation fails like
  46. /bin/ld: menu-merge.o:menu-cache-gen/menu-tags.h:167: multiple definition of `DirDirs'; main.o:menu-cache-gen/menu-tags.h:167: first defined here
  47. /bin/ld: menu-merge.o:menu-cache-gen/menu-tags.h:164: multiple definition of `AppDirs'; main.o:menu-cache-gen/menu-tags.h:164: first defined here
  48. /bin/ld: menu-merge.o:menu-cache-gen/menu-tags.h:52: multiple definition of `menuTag_Layout'; main.o:menu-cache-gen/menu-tags.h:52: first defined here
  49. ....
  50. This patch fixes compilation with gcc10: properly declaring variables in header with "extern", and also removing some unneeded variables in header files.
  51. ---
  52. menu-cache-gen/menu-tags.h | 55 ++++++++++++--------------------------
  53. 1 file changed, 17 insertions(+), 38 deletions(-)
  54. diff --git a/menu-cache-gen/menu-tags.h b/menu-cache-gen/menu-tags.h
  55. index f3fd7d3..f71c0bc 100644
  56. --- a/menu-cache-gen/menu-tags.h
  57. +++ b/menu-cache-gen/menu-tags.h
  58. @@ -22,38 +22,17 @@
  59. #include <libfm/fm-extra.h>
  60. #include <menu-cache.h>
  61. -FmXmlFileTag menuTag_Menu;
  62. -FmXmlFileTag menuTag_AppDir;
  63. -FmXmlFileTag menuTag_DefaultAppDirs;
  64. -FmXmlFileTag menuTag_DirectoryDir;
  65. -FmXmlFileTag menuTag_DefaultDirectoryDirs;
  66. -FmXmlFileTag menuTag_Include;
  67. -FmXmlFileTag menuTag_Exclude;
  68. -FmXmlFileTag menuTag_Filename;
  69. -FmXmlFileTag menuTag_Or;
  70. -FmXmlFileTag menuTag_And;
  71. -FmXmlFileTag menuTag_Not;
  72. -FmXmlFileTag menuTag_Category;
  73. -FmXmlFileTag menuTag_MergeFile;
  74. -FmXmlFileTag menuTag_MergeDir;
  75. -FmXmlFileTag menuTag_DefaultMergeDirs;
  76. -FmXmlFileTag menuTag_Directory;
  77. -FmXmlFileTag menuTag_Name;
  78. -FmXmlFileTag menuTag_Deleted;
  79. -FmXmlFileTag menuTag_NotDeleted;
  80. -FmXmlFileTag menuTag_OnlyUnallocated;
  81. -FmXmlFileTag menuTag_NotOnlyUnallocated;
  82. -FmXmlFileTag menuTag_All;
  83. -FmXmlFileTag menuTag_LegacyDir;
  84. -FmXmlFileTag menuTag_KDELegacyDirs;
  85. -FmXmlFileTag menuTag_Move;
  86. -FmXmlFileTag menuTag_Old;
  87. -FmXmlFileTag menuTag_New;
  88. -FmXmlFileTag menuTag_Layout;
  89. -FmXmlFileTag menuTag_DefaultLayout;
  90. -FmXmlFileTag menuTag_Menuname;
  91. -FmXmlFileTag menuTag_Separator;
  92. -FmXmlFileTag menuTag_Merge;
  93. +extern FmXmlFileTag menuTag_AppDir;
  94. +extern FmXmlFileTag menuTag_DirectoryDir;
  95. +extern FmXmlFileTag menuTag_Include;
  96. +extern FmXmlFileTag menuTag_Exclude;
  97. +extern FmXmlFileTag menuTag_Filename;
  98. +extern FmXmlFileTag menuTag_Or;
  99. +extern FmXmlFileTag menuTag_And;
  100. +extern FmXmlFileTag menuTag_Not;
  101. +extern FmXmlFileTag menuTag_Category;
  102. +extern FmXmlFileTag menuTag_All;
  103. +extern FmXmlFileTag menuTag_LegacyDir;
  104. typedef enum {
  105. MERGE_NONE, /* starting value */
  106. @@ -152,19 +131,19 @@ typedef struct {
  107. } MenuRule;
  108. /* requested language(s) */
  109. -char **languages;
  110. +extern char **languages;
  111. /* list of menu files to monitor */
  112. -GSList *MenuFiles;
  113. +extern GSList *MenuFiles;
  114. /* list of menu dirs to monitor */
  115. -GSList *MenuDirs;
  116. +extern GSList *MenuDirs;
  117. /* list of available app dirs */
  118. -GSList *AppDirs;
  119. +extern GSList *AppDirs;
  120. /* list of available dir dirs */
  121. -GSList *DirDirs;
  122. +extern GSList *DirDirs;
  123. /* parse and merge menu files */
  124. MenuMenu *get_merged_menu(const char *file, FmXmlFile **xmlfile, GError **error);
  125. @@ -177,7 +156,7 @@ gboolean save_menu_cache(MenuMenu *layout, const char *menuname, const char *fil
  126. void _free_layout_items(GList *data);
  127. /* verbosity level */
  128. -gint verbose;
  129. +extern gint verbose;
  130. #define DBG if (verbose) g_debug
  131. #define VDBG if (verbose > 1) g_debug