[gabedit] drop the gtk patch and build with -DENABLE_DEPRECATED

Dominik Mierzejewski rathann at fedoraproject.org
Mon Oct 14 21:17:21 UTC 2013


commit 3bb32254c16db32a7bd14aa66c24d62197127c07
Author: Dominik Mierzejewski <rpm at greysector.net>
Date:   Mon Oct 14 23:17:02 2013 +0200

    drop the gtk patch and build with -DENABLE_DEPRECATED
    
    fix crashes when user doesn't select any folder in dialog

 gabedit-bug774594.patch |   19 -
 gabedit-gtk.patch       | 3785 -----------------------------------------------
 gabedit-strlen.patch    |  102 ++
 gabedit.spec            |   15 +-
 4 files changed, 110 insertions(+), 3811 deletions(-)
---
diff --git a/gabedit-strlen.patch b/gabedit-strlen.patch
new file mode 100644
index 0000000..1e6141b
--- /dev/null
+++ b/gabedit-strlen.patch
@@ -0,0 +1,102 @@
+diff -up GabeditSrc247/src/Display/PovrayGL.c.strlen GabeditSrc247/src/Display/PovrayGL.c
+--- GabeditSrc247/src/Display/PovrayGL.c.strlen	2013-08-19 13:42:23.000000000 +0200
++++ GabeditSrc247/src/Display/PovrayGL.c	2013-10-14 23:01:56.347483447 +0200
+@@ -1671,7 +1671,8 @@ static void exportPOVRay(GtkWidget* Win,
+ 		gint i;
+ 		if(tmp) l = strlen(tmp);
+ 		for(i=l-1;i>=1;i--) if(tmp[i]=='.') tmp[i]='\0';
+-		if(dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
++		if(!dirName) dirName = g_strdup(g_get_current_dir());
++		if(dirName && dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
+ 		{
+ 			fileNamePOV = g_strdup_printf("%s%s%s.pov",dirName, G_DIR_SEPARATOR_S,tmp);
+ 			fileNameIMG = g_strdup_printf("%s%s%s.bmp",dirName, G_DIR_SEPARATOR_S,tmp);
+diff -up GabeditSrc247/src/Geometry/Povray.c.strlen GabeditSrc247/src/Geometry/Povray.c
+--- GabeditSrc247/src/Geometry/Povray.c.strlen	2013-08-19 13:42:23.000000000 +0200
++++ GabeditSrc247/src/Geometry/Povray.c	2013-10-14 23:02:56.733675408 +0200
+@@ -1158,7 +1158,8 @@ static void exportPOVRay(GtkWidget* Win,
+ 		gint i;
+ 		if(tmp) l = strlen(tmp);
+ 		for(i=l-1;i>=1;i--) if(tmp[i]=='.') tmp[i]='\0';
+-		if(dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
++		if(!dirName) dirName = g_strdup(g_get_current_dir());
++		if(dirName && dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
+ 		{
+ 			fileNamePOV = g_strdup_printf("%s%s%s.pov",dirName, G_DIR_SEPARATOR_S,tmp);
+ 			fileNameIMG = g_strdup_printf("%s%s%s.bmp",dirName, G_DIR_SEPARATOR_S,tmp);
+diff -up GabeditSrc247/src/MolecularMechanics/MolecularMechanicsDlg.c.strlen GabeditSrc247/src/MolecularMechanics/MolecularMechanicsDlg.c
+--- GabeditSrc247/src/MolecularMechanics/MolecularMechanicsDlg.c.strlen	2013-08-19 13:42:23.000000000 +0200
++++ GabeditSrc247/src/MolecularMechanics/MolecularMechanicsDlg.c	2013-10-14 23:03:51.776852537 +0200
+@@ -1212,7 +1213,8 @@ static void amberMolecularDynamicsConfo(
+ 	{
+ 		gchar* dirName = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector));
+ 		gchar* tmp = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryFileNameGeom)));
+-		if(dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
++		if(!dirName) dirName = g_strdup(g_get_current_dir());
++		if(dirName && dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
+ 			fileNameGeom = g_strdup_printf("%s%s%s",dirName, G_DIR_SEPARATOR_S,tmp);
+ 		else
+ 			fileNameGeom = g_strdup_printf("%s%s",dirName, tmp);
+diff -up GabeditSrc247/src/SemiEmpirical/SemiEmpiricalDlg.c.strlen GabeditSrc247/src/SemiEmpirical/SemiEmpiricalDlg.c
+--- GabeditSrc247/src/SemiEmpirical/SemiEmpiricalDlg.c.strlen	2013-08-19 13:42:23.000000000 +0200
++++ GabeditSrc247/src/SemiEmpirical/SemiEmpiricalDlg.c	2013-10-14 23:05:41.734208705 +0200
+@@ -1035,6 +1035,7 @@ static void runSemiEmpirical(GtkWidget*
+ 	{
+ 		gchar* dirName = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector));
+ 		gchar* tmp = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryFileName)));
++		if(!dirName) dirName = g_strdup(g_get_home_dir());
+ 		if(dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
+ 			fileName = g_strdup_printf("%s%s%s",dirName, G_DIR_SEPARATOR_S,tmp);
+ 		else
+@@ -3622,7 +3623,8 @@ static void semiEmpiricalMDConfo(GtkWidg
+ 	{
+ 		dirName = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector));
+ 		gchar* tmp = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryFileNameGeom)));
+-		if(dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
++		if(!dirName) dirName = g_strdup(g_get_current_dir());
++		if(dirName && dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
+ 			fileNameGeom = g_strdup_printf("%s%s%s",dirName, G_DIR_SEPARATOR_S,tmp);
+ 		else
+ 			fileNameGeom = g_strdup_printf("%s%s",dirName, tmp);
+@@ -3640,7 +3642,8 @@ static void semiEmpiricalMDConfo(GtkWidg
+ 	{
+ 		if(!dirName) dirName = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector));
+ 		gchar* tmp = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryFileNameTraj)));
+-		if(dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
++		if(!dirName) dirName = g_strdup(g_get_current_dir());
++		if(dirName && dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
+ 			fileNameTraj = g_strdup_printf("%s%s%s",dirName, G_DIR_SEPARATOR_S,tmp);
+ 		else
+ 			fileNameTraj = g_strdup_printf("%s%s",dirName, tmp);
+@@ -3652,7 +3655,8 @@ static void semiEmpiricalMDConfo(GtkWidg
+ 	{
+ 		if(!dirName) dirName = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector));
+ 		gchar* tmp = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryFileNameProp)));
+-		if(dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
++		if(!dirName) dirName = g_strdup(g_get_current_dir());
++		if(dirName && dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
+ 			fileNameProp = g_strdup_printf("%s%s%s",dirName, G_DIR_SEPARATOR_S,tmp);
+ 		else
+ 			fileNameProp = g_strdup_printf("%s%s",dirName, tmp);
+@@ -3896,10 +3900,11 @@ static void semiEmpiricalMD(GtkWidget* W
+ 	if(stepSize>5) stepSize = 5.0;
+ 
+ 	dirName = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector));
++	if(!dirName) dirName = g_strdup(g_get_current_dir());
+ 	if(GTK_TOGGLE_BUTTON (buttonSaveTraj)->active)
+ 	{
+ 		gchar* tmp = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryFileNameTraj)));
+-		if(dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
++		if(dirName && dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
+ 			fileNameTraj = g_strdup_printf("%s%s%s",dirName, G_DIR_SEPARATOR_S,tmp);
+ 		else
+ 			fileNameTraj = g_strdup_printf("%s%s",dirName, tmp);
+@@ -3909,7 +3914,7 @@ static void semiEmpiricalMD(GtkWidget* W
+ 	if(GTK_TOGGLE_BUTTON (buttonSaveProp)->active)
+ 	{
+ 		gchar* tmp = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryFileNameProp)));
+-		if(dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
++		if(dirName && dirName[strlen(dirName)-1] != G_DIR_SEPARATOR)
+ 			fileNameProp = g_strdup_printf("%s%s%s",dirName, G_DIR_SEPARATOR_S,tmp);
+ 		else
+ 			fileNameProp = g_strdup_printf("%s%s",dirName, tmp);
diff --git a/gabedit.spec b/gabedit.spec
index f04f2d0..4ecf0d6 100644
--- a/gabedit.spec
+++ b/gabedit.spec
@@ -3,16 +3,14 @@
 Name:		gabedit
 Summary:	GUI for computational chemistry
 Version:	2.4.7
-Release:	2%{?dist}
+Release:	3%{?dist}
 Source0:	http://downloads.sourceforge.net/sourceforge/gabedit/GabeditSrc%{tarver}.tar.gz
 # fix some compilation warnings
 Patch1:		%{name}-warnings.patch
 # fix csh shebang
 Patch2:		%{name}-csh.patch
-# fix build against current GTK2
-Patch3:		%{name}-gtk.patch
-# fix bug #774594
-Patch4:		%{name}-bug774594.patch
+# fix bug #774594 and other crashes
+Patch4:		%{name}-strlen.patch
 URL:		http://gabedit.sourceforge.net/home.html
 License:	MIT
 Group:		Applications/Engineering
@@ -39,7 +37,6 @@ file formats are supported.
 %setup -q -n GabeditSrc%{tarver}
 %patch1 -p1 -b .warn
 %patch2 -p1
-%patch3 -p1 -b .gtk
 %patch4 -p1 -b .strlen
 # remove Win32-specific files
 %{__rm} -r utils/InnosSetupScriptWin32
@@ -51,7 +48,7 @@ tr -d '\r' < isotopNIST.txt > isotopNIST.txt.unix && touch -r isotopNIST.txt iso
 popd
 
 %build
-%{__make} %{?_smp_mflags} COMMONCFLAGS="$RPM_OPT_FLAGS -DENABLE_OMP -fopenmp -DDRAWGEOMGL"
+%{__make} %{?_smp_mflags} COMMONCFLAGS="$RPM_OPT_FLAGS -DENABLE_OMP -fopenmp -DDRAWGEOMGL -DENABLE_DEPRECATED"
 
 %install
 rm -rf %{buildroot}
@@ -92,6 +89,10 @@ fi
 %{_datadir}/icons/hicolor/*/apps/*.png
 
 %changelog
+* Mon Oct 14 2013 Dominik Mierzejewski <rpm at greysector.net> 2.4.7-3
+- drop the gtk patch and build with -DENABLE_DEPRECATED
+- fix crashes when user doesn't select any folder in dialog
+
 * Sun Oct 13 2013 Dominik Mierzejewski <rpm at greysector.net> 2.4.7-2
 - drop some erroneous hunks from gtk patch
 


More information about the scm-commits mailing list