1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Sat, 25 Jan 2025 22:03:43 +0100
Origin: upstream, https://sourceforge.net/p/mcj/xfig/ci/e8420fd
Forwarded: not-needed
Subject: Return on invalid directory listings
A copy of patch xfig.3.2.5b-null from the opensuse xfig repository,
https://build.opensuse.org/projects/openSUSE:Factory/packages/xfig/files/xfig.3.2.5b-null.dif
--- a/src/w_dir.c
+++ b/src/w_dir.c
@@ -5,7 +5,7 @@
* Parts Copyright (c) 1990 by Digital Equipment Corporation. All Rights Reserved.
* Parts Copyright (c) 1990 by Digital Equipment Corporation
* Parts Copyright (c) 1991 by Paul King
- * Parts Copyright (c) 2016-2024 by Thomas Loimer
+ * Parts Copyright (c) 2016-2025 by Thomas Loimer
*
* Any party obtaining a copy of these files is granted, free of charge, a
* full and unrestricted irrevocable, world-wide, paid up, royalty-free,
@@ -146,25 +146,32 @@ FileSelected(Widget w, XtPointer client_
(void)w;
(void)client_data;
- XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
-
- strcpy(CurrentSelectionName, ret_struct->string);
- FirstArg(XtNstring, CurrentSelectionName);
- if (browse_up) {
- SetValues(browse_selfile);
- XawTextSetInsertionPoint(browse_selfile, strlen(CurrentSelectionName));
- } else if (file_up) {
- SetValues(file_selfile);
- XawTextSetInsertionPoint(file_selfile, strlen(CurrentSelectionName));
- /* and show a preview of the figure in the preview canvas */
- preview_figure(CurrentSelectionName, file_popup, preview_widget,
- preview_size);
- } else if (export_up) {
- SetValues(exp_selfile);
- XawTextSetInsertionPoint(exp_selfile, strlen(CurrentSelectionName));
- }
- /* if nothing is selected it probably means that the user was impatient and
- double clicked the file name again while it was still loading the first */
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *)call_data;
+ if (!ret_struct)
+ return;
+
+ strcpy(CurrentSelectionName, ret_struct->string);
+ FirstArg(XtNstring, CurrentSelectionName);
+ if (browse_up) {
+ SetValues(browse_selfile);
+ XawTextSetInsertionPoint(browse_selfile,
+ strlen(CurrentSelectionName));
+ } else if (file_up) {
+ SetValues(file_selfile);
+ XawTextSetInsertionPoint(file_selfile,
+ strlen(CurrentSelectionName));
+ /* and show a preview of the figure in the preview canvas */
+ preview_figure(CurrentSelectionName, file_popup, preview_widget,
+ preview_size);
+ } else if (export_up) {
+ SetValues(exp_selfile);
+ XawTextSetInsertionPoint(exp_selfile,
+ strlen(CurrentSelectionName));
+ }
+ /* if nothing is selected it probably means that the user was impatient
+ * and double clicked the file name again while it was still loading the
+ * first
+ */
}
/* Function: DirSelected() is called when the user selects a directory.
@@ -180,10 +187,12 @@ DirSelected(Widget w, XtPointer client_d
(void)w;
(void)client_data;
- XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *)call_data;
- strcpy(CurrentSelectionName, ret_struct->string);
- DoChangeDir(CurrentSelectionName);
+ if (!ret_struct)
+ return;
+ strcpy(CurrentSelectionName, ret_struct->string);
+ DoChangeDir(CurrentSelectionName);
}
void
--- a/src/w_library.c
+++ b/src/w_library.c
@@ -501,7 +501,10 @@ NewObjectSel(Widget w, XtPointer closure
(void)w;
(void)closure;
int new_obj;
- XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *)call_data;
+
+ if (!ret_struct)
+ return;
new_obj = ret_struct->list_index;
if (icons_made) {
--- a/src/w_srchrepl.c
+++ b/src/w_srchrepl.c
@@ -4,7 +4,7 @@
* Parts Copyright (c) 1989-2015 by Brian V. Smith
* Parts Copyright (c) 1991 by Paul King
* Parts Copyright (c) 1997 by T. Sato
- * Parts Copyright (c) 2016-2024 by Thomas Loimer
+ * Parts Copyright (c) 2016-2025 by Thomas Loimer
*
* Any party obtaining a copy of these files is granted, free of charge, a
* full and unrestricted irrevocable, world-wide, paid up, royalty-free,
@@ -919,7 +919,9 @@ static void
spell_select_word(Widget widget, XtPointer closure, XtPointer call_data)
{
(void)widget; (void)closure;
- XawListReturnStruct *ret_struct = (XawListReturnStruct *) call_data;
+ XawListReturnStruct *ret_struct = (XawListReturnStruct *)call_data;
+ if (!ret_struct)
+ return;
/* make correct button and correction entry sensitive */
XtSetSensitive(correct_button, True);
|