summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 126af29)
raw | patch | inline | side by side (parent: 126af29)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 1 Mar 2009 21:47:20 +0000 (21:47 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 1 Mar 2009 21:47:20 +0000 (21:47 +0000) |
src/file.cpp | patch | blob | history |
diff --git a/src/file.cpp b/src/file.cpp
index 396e9095f17b87673d3a12871cd2f1a54f741cd7..2467b8914771199ac535e63daa7c742c4ccb2dba 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -448,7 +448,7 @@ sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d
open_path.append(G_DIR_SEPARATOR_S);
}
- //# Create a dialog if we don't already have one
+ //# Create a dialog
Inkscape::UI::Dialog::FileOpenDialog *openDialogInstance =
Inkscape::UI::Dialog::FileOpenDialog::create(
parentWindow, open_path,
// a document:: method to return the current layer.
// For now, we just use the root in this case.
SPObject *place_to_insert;
- if (desktop) place_to_insert = desktop->currentLayer();
- else place_to_insert = SP_DOCUMENT_ROOT(in_doc);
+ if (desktop) {
+ place_to_insert = desktop->currentLayer();
+ } else {
+ place_to_insert = SP_DOCUMENT_ROOT(in_doc);
+ }
// Construct a new object representing the imported image,
// and insert it into the current document.
}
-static Inkscape::UI::Dialog::FileOpenDialog *importDialogInstance = NULL;
-
/**
* Display an Open dialog, import a resource if OK pressed.
*/
if (!doc)
return;
- if (!importDialogInstance) {
- importDialogInstance =
+ // Create new dialog (don't use an old one, because parentWindow has probably changed)
+ Inkscape::UI::Dialog::FileOpenDialog *importDialogInstance =
Inkscape::UI::Dialog::FileOpenDialog::create(
parentWindow,
import_path,
Inkscape::UI::Dialog::IMPORT_TYPES,
(char const *)_("Select file to import"));
- }
bool success = importDialogInstance->show();
- if (!success)
+ if (!success) {
+ delete importDialogInstance;
return;
+ }
//# Get file name and extension type
Glib::ustring fileName = importDialogInstance->getFilename();
- Inkscape::Extension::Extension *selection =
- importDialogInstance->getSelectionType();
+ Inkscape::Extension::Extension *selection = importDialogInstance->getSelectionType();
+ delete importDialogInstance;
+ importDialogInstance = NULL;
if (fileName.size() > 0) {