Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

Commit

Permalink
Remove unneeded try/catch from IllustrationView::OnCreate()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vadz authored and Gregory W. Chicares committed May 22, 2022
1 parent 869fd43 commit 1ea88e7
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions illustration_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 1ea88e7

Please sign in to comment.