summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2002-05-01 21:41:59 +0000
committerMatthias Melcher <fltk@matthiasm.com>2002-05-01 21:41:59 +0000
commitd5b98e56c0f3f29b94fdabd997c5dafa3dd05588 (patch)
tree752408897b4ebabbf886bc5725934bf640a7bac3
parentc0670cdc55ecd3908a3e45eee16806bd417dbf59 (diff)
Fixed 'Open Previuos' bug in FLUID.
'set_filename' in 'open_histroy_cb' would change the filename before the file was opened, hence opening the file one up in the list. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2169 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--fluid/fluid.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx
index 8d50d46db..9f3ef1983 100644
--- a/fluid/fluid.cxx
+++ b/fluid/fluid.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fluid.cxx,v 1.15.2.13.2.21 2002/05/01 19:17:24 easysw Exp $"
+// "$Id: fluid.cxx,v 1.15.2.13.2.22 2002/05/01 21:41:59 matthiaswm Exp $"
//
// FLUID main entry for the Fast Light Tool Kit (FLTK).
//
@@ -162,12 +162,15 @@ void open_cb(Fl_Widget *, void *v) {
void open_history_cb(Fl_Widget *, void *v) {
if (modflag && !fl_ask("Discard changes?")) return;
- set_filename((char *)v);
- if (!read_file((char *)v, 0)) {
+ char *localcopy = strdup( (char*)v );
+ if (!read_file(localcopy, 0)) {
fl_message("Can't read %s: %s", v, strerror(errno));
+ free(localcopy);
return;
}
+ set_filename(localcopy);
modflag = 0;
+ free(localcopy);
}
void new_cb(Fl_Widget *, void *v) {
@@ -530,7 +533,7 @@ void update_history(const char *filename) {
#if defined(WIN32) || defined(__APPLE__)
if (!strcasecmp(absolute, absolute_history[i])) break;
#else
- if (!strcasecmp(absolute, absolute_history[i])) break;
+ if (!strcmp(absolute, absolute_history[i])) break;
#endif // WIN32 || __APPLE__
if (i == 0) return;
@@ -777,5 +780,5 @@ int main(int argc,char **argv) {
}
//
-// End of "$Id: fluid.cxx,v 1.15.2.13.2.21 2002/05/01 19:17:24 easysw Exp $".
+// End of "$Id: fluid.cxx,v 1.15.2.13.2.22 2002/05/01 21:41:59 matthiaswm Exp $".
//