Browse Source

Small fix. Event should be sent when editor closed

rsredsq 10 years ago
parent
commit
483ff90cf2
1 changed files with 6 additions and 5 deletions
  1. 6 5
      Source/AtomicEditor/Editors/ResourceEditor.cpp

+ 6 - 5
Source/AtomicEditor/Editors/ResourceEditor.cpp

@@ -49,6 +49,7 @@ public:
         }
         }
         else
         else
         {
         {
+            editor_->Close();
             return true;
             return true;
         }
         }
     }
     }
@@ -61,12 +62,8 @@ public:
             {
             {
                 if (ev.ref_id == TBIDC("TBMessageWindow.ok"))
                 if (ev.ref_id == TBIDC("TBMessageWindow.ok"))
                 {
                 {
-                    SharedPtr<ResourceEditor> keepalive(editor_);
                     container_->OnEvent(ev);
                     container_->OnEvent(ev);
                     editor_->Close();
                     editor_->Close();
-                    VariantMap editorClosedEvent;
-                    editorClosedEvent[ResourceEditorClosed::P_RESOURCEEDITOR] = editor_;
-                    editor_->SendEvent(E_RESOURCEEDITORCLOSED, editorClosedEvent);
                 }
                 }
                 else
                 else
                 {
                 {
@@ -79,7 +76,6 @@ public:
                 if (RequestClose())
                 if (RequestClose())
                 {
                 {
                     container_->OnEvent(ev);
                     container_->OnEvent(ev);
-                    editor_->Close();
                     return true;
                     return true;
                 }
                 }
             }
             }
@@ -169,6 +165,11 @@ void ResourceEditor::Close(bool navigateToAvailableResource)
     data["Editor"] = this;
     data["Editor"] = this;
     data["NavigateToAvailableResource"] = navigateToAvailableResource;
     data["NavigateToAvailableResource"] = navigateToAvailableResource;
     SendEvent("EditorCloseResource", data);
     SendEvent("EditorCloseResource", data);
+
+
+    VariantMap editorClosedEvent;
+    editorClosedEvent[ResourceEditorClosed::P_RESOURCEEDITOR] = this;
+    SendEvent(E_RESOURCEEDITORCLOSED, editorClosedEvent);
 }
 }
 
 
 void ResourceEditor::InvokeShortcut(const String& shortcut)
 void ResourceEditor::InvokeShortcut(const String& shortcut)