[freeglut] fix #1017551: don't crash on manipulating active menus
Tomas Smetana
tsmetana at fedoraproject.org
Thu Jan 23 13:51:41 UTC 2014
commit acaa392c7a930a39bae28bc03e0408ab09f3840a
Author: Tomas Smetana <tsmetana at redhat.com>
Date: Thu Jan 23 14:51:48 2014 +0100
fix #1017551: don't crash on manipulating active menus
freeglut-2.8.1-nocheck.patch | 85 ++++++++++++++++++++++++++++++++++++++++++
freeglut.spec | 8 +++-
2 files changed, 92 insertions(+), 1 deletions(-)
---
diff --git a/freeglut-2.8.1-nocheck.patch b/freeglut-2.8.1-nocheck.patch
new file mode 100644
index 0000000..bbc5fd5
--- /dev/null
+++ b/freeglut-2.8.1-nocheck.patch
@@ -0,0 +1,85 @@
+diff -up freeglut-2.8.1/src/freeglut_menu.c.nocheck freeglut-2.8.1/src/freeglut_menu.c
+--- freeglut-2.8.1/src/freeglut_menu.c.nocheck 2014-01-23 14:43:19.386742857 +0100
++++ freeglut-2.8.1/src/freeglut_menu.c 2014-01-23 14:44:26.322770844 +0100
+@@ -866,8 +866,6 @@ int FGAPIENTRY glutCreateMenu( void(* ca
+ {
+ /* The menu object creation code resides in freeglut_structure.c */
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutCreateMenu" );
+- if (fgGetActiveMenu())
+- fgError("Menu manipulation not allowed while menus in use.");
+ return fgCreateMenu( callback )->ID;
+ }
+
+@@ -891,9 +889,6 @@ void FGAPIENTRY glutDestroyMenu( int men
+
+ freeglut_return_if_fail( menu );
+
+- if (fgGetActiveMenu())
+- fgError("Menu manipulation not allowed while menus in use.");
+-
+ /* The menu object destruction code resides in freeglut_structure.c */
+ fgDestroyMenu( menu );
+ }
+@@ -936,8 +931,6 @@ void FGAPIENTRY glutAddMenuEntry( const
+ menuEntry = (SFG_MenuEntry *)calloc( sizeof(SFG_MenuEntry), 1 );
+
+ freeglut_return_if_fail( fgStructure.CurrentMenu );
+- if (fgGetActiveMenu())
+- fgError("Menu manipulation not allowed while menus in use.");
+
+ menuEntry->Text = strdup( label );
+ menuEntry->ID = value;
+@@ -961,8 +954,6 @@ void FGAPIENTRY glutAddSubMenu( const ch
+ subMenu = fgMenuByID( subMenuID );
+
+ freeglut_return_if_fail( fgStructure.CurrentMenu );
+- if (fgGetActiveMenu())
+- fgError("Menu manipulation not allowed while menus in use.");
+
+ freeglut_return_if_fail( subMenu );
+
+@@ -984,8 +975,6 @@ void FGAPIENTRY glutChangeToMenuEntry( i
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutChangeToMenuEntry" );
+
+ freeglut_return_if_fail( fgStructure.CurrentMenu );
+- if (fgGetActiveMenu())
+- fgError("Menu manipulation not allowed while menus in use.");
+
+ /* Get n-th menu entry in the current menu, starting from one: */
+ menuEntry = fghFindMenuEntry( fgStructure.CurrentMenu, item );
+@@ -1014,8 +1003,6 @@ void FGAPIENTRY glutChangeToSubMenu( int
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutChangeToSubMenu" );
+
+ freeglut_return_if_fail( fgStructure.CurrentMenu );
+- if (fgGetActiveMenu())
+- fgError("Menu manipulation not allowed while menus in use.");
+
+ /* Get handle to sub menu */
+ subMenu = fgMenuByID( subMenuID );
+@@ -1048,8 +1035,6 @@ void FGAPIENTRY glutRemoveMenuItem( int
+ FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutRemoveMenuItem" );
+
+ freeglut_return_if_fail( fgStructure.CurrentMenu );
+- if (fgGetActiveMenu())
+- fgError("Menu manipulation not allowed while menus in use.");
+
+ /* Get n-th menu entry in the current menu, starting from one: */
+ menuEntry = fghFindMenuEntry( fgStructure.CurrentMenu, item );
+@@ -1074,8 +1059,6 @@ void FGAPIENTRY glutAttachMenu( int butt
+ freeglut_return_if_fail( fgStructure.CurrentWindow );
+
+ freeglut_return_if_fail( fgStructure.CurrentMenu );
+- if (fgGetActiveMenu())
+- fgError("Menu manipulation not allowed while menus in use.");
+
+ freeglut_return_if_fail( button >= 0 );
+ freeglut_return_if_fail( button < FREEGLUT_MAX_MENUS );
+@@ -1093,8 +1076,6 @@ void FGAPIENTRY glutDetachMenu( int butt
+ freeglut_return_if_fail( fgStructure.CurrentWindow );
+
+ freeglut_return_if_fail( fgStructure.CurrentMenu );
+- if (fgGetActiveMenu())
+- fgError("Menu manipulation not allowed while menus in use.");
+
+ freeglut_return_if_fail( button >= 0 );
+ freeglut_return_if_fail( button < FREEGLUT_MAX_MENUS );
diff --git a/freeglut.spec b/freeglut.spec
index ff30789..83fb6fb 100644
--- a/freeglut.spec
+++ b/freeglut.spec
@@ -1,7 +1,7 @@
Summary: A freely licensed alternative to the GLUT library
Name: freeglut
Version: 2.8.1
-Release: 2%{?dist}
+Release: 3%{?dist}
URL: http://freeglut.sourceforge.net
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
# For the manpages
@@ -18,6 +18,8 @@ BuildRequires: libXi-devel libICE-devel
# freeglut. Note: This package will NOT co-exist with the glut package.
Provides: glut = 3.7
Obsoletes: glut < 3.7
+# #1017551: Don't check whether a menu is active while manipulating it
+Patch0: freeglut-2.8.1-nocheck.patch
%description
freeglut is a completely open source alternative to the OpenGL Utility Toolkit
@@ -48,6 +50,7 @@ license.
%prep
%setup -q -a 1
+%patch0 -p1 -b .nocheck
%build
# --disable-warnings -> don't add -Werror to CFLAGS
@@ -81,6 +84,9 @@ install -p -m 644 doc/man/*.3 $RPM_BUILD_ROOT/%{_mandir}/man3
%changelog
+* Thu Jan 23 2014 Tomas Smetana <tsmetana at redhat.com> - 2.8.1-3
+- fix #1017551: don't crash on manipulating active menus
+
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.8.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
More information about the scm-commits
mailing list