]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_cb.C
Fix fuer #209
[lyx.git] / src / lyx_cb.C
index 43cfb02da6d044e26f222bbdb13d2996457c6db6..4dba209bcbc6f595b01c62b569ead25dcb198027 100644 (file)
@@ -121,9 +121,10 @@ void ShowMessage(Buffer const * buf,
                 string const & msg2,
                 string const & msg3)
 {
-       if (lyxrc.use_gui) {
-               string const str = msg1 + ' ' + msg2 + ' ' + msg3;
-               buf->getUser()->owner()->message(str);
+       if (lyxrc.use_gui
+           && buf && buf->getUser() && buf->getUser()->owner()) {
+                       string const str = msg1 + ' ' + msg2 + ' ' + msg3;
+                       buf->getUser()->owner()->message(str);
        } else
                lyxerr << msg1 << msg2 << msg3 << endl;
 }
@@ -143,10 +144,8 @@ bool MenuWrite(BufferView * bv, Buffer * buffer)
        XFlush(GUIRunTime::x11Display());
  
        if (!buffer->save()) {
-               string const fname = buffer->fileName();
-               string const s = MakeAbsPath(fname);
                if (Alert::askQuestion(_("Save failed. Rename and try again?"),
-                               MakeDisplayPath(s, 50),
+                               MakeDisplayPath(buffer->fileName(), 50),
                                _("(If not, document is not saved.)"))) {
                        return WriteAs(bv, buffer);
                }
@@ -325,7 +324,7 @@ void AutoSave(BufferView * bv)
        bv->owner()->message(_("Autosaving current document..."));
        
        // create autosave filename
-       string fname =  OnlyPath(bv->buffer()->fileName());
+       string fname =  bv->buffer()->filePath();
        fname += "#";
        fname += OnlyFilename(bv->buffer()->fileName());
        fname += "#";
@@ -420,7 +419,7 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
                FileDialog fileDlg(bv->owner(), _("Select file to insert"),
                        (asParagraph) ? LFUN_FILE_INSERT_ASCII_PARA : LFUN_FILE_INSERT_ASCII);
  
-               FileDialog::Result result = fileDlg.Select(bv->owner()->buffer()->filepath);
+               FileDialog::Result result = fileDlg.Select(bv->owner()->buffer()->filePath());
 
                if (result.first == FileDialog::Later)
                        return;