lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] odd/remove-all-view-report-exception 9f3f6be3 1/2: R


From: Greg Chicares
Subject: [lmi-commits] [lmi] odd/remove-all-view-report-exception 9f3f6be3 1/2: Remove unneeded try/catch from IllustrationView::OnCreate()
Date: Sun, 22 May 2022 12:35:54 -0400 (EDT)

branch: odd/remove-all-view-report-exception
commit 9f3f6be3ea8904ff043ca58cab0aeb8dc9e9f123
Author: Vadim Zeitlin <vadim@tt-solutions.com>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Remove unneeded try/catch from IllustrationView::OnCreate()
    
    This was a workaround for a problem in wxWidgets fixed a long time ago,
    see wxWidgets commit 7047d7981f (handle exceptions thrown from
    overridden wxView::OnCreate() gracefully, 2008-12-30) and is not needed
    any longer: no view is created if an exception is thrown from here.
    
    This commit is best viewed ignoring whitespace-only changes.
---
 illustration_view.cpp | 37 +++++++++++++------------------------
 1 file changed, 13 insertions(+), 24 deletions(-)

diff --git a/illustration_view.cpp b/illustration_view.cpp
index 3eda390f..99abb1e0 100644
--- a/illustration_view.cpp
+++ b/illustration_view.cpp
@@ -145,42 +145,31 @@ char const* IllustrationView::menubar_xrc_resource() const
 }
 
 /// Pop up an input dialog; iff it's not cancelled, create a view.
-///
-/// Trap exceptions to ensure that this function returns 'false' on
-/// failure, lest wx's doc-view framework create a zombie view. See:
-///   https://lists.nongnu.org/archive/html/lmi/2008-12/msg00017.html
 
 bool IllustrationView::OnCreate(wxDocument* doc, long int flags)
 {
     bool has_view_been_created = false;
 
-    try
+    if(flags & LMI_WX_CHILD_DOCUMENT)
         {
-        if(flags & LMI_WX_CHILD_DOCUMENT)
-            {
-            is_phony_ = true;
-            has_view_been_created = ViewEx::DoOnCreate(doc, flags);
-            return has_view_been_created;
-            }
-
-        if(oe_mvc_dv_cancelled == edit_parameters())
-            {
-            return has_view_been_created;
-            }
-
+        is_phony_ = true;
         has_view_been_created = ViewEx::DoOnCreate(doc, flags);
-        if(!has_view_been_created)
-            {
-            return has_view_been_created;
-            }
+        return has_view_been_created;
+        }
 
-        Run();
+    if(oe_mvc_dv_cancelled == edit_parameters())
+        {
+        return has_view_been_created;
         }
-    catch(...)
+
+    has_view_been_created = ViewEx::DoOnCreate(doc, flags);
+    if(!has_view_been_created)
         {
-        report_exception();
+        return has_view_been_created;
         }
 
+    Run();
+
     return has_view_been_created;
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]