Opened 4 years ago

Closed 20 months ago

#12763 closed defect (fixed)

Override of wxLogWindow::OnFrameCreate gets never called

Reported by: MathiasDz Owned by:
Priority: low Milestone: 3.0.0
Component: GUI-all Version: stable-latest
Keywords: wxLogWindow, OnFrameCreate Cc:
Blocked By: Blocking:
Patch: no

Description

Overriding wxLogWindow::OnFrameCreate is useless, because the method gets never called.

wxLogWindow::OnFrameCreate is indirectly called (via wxLogFrame::wxLogFrame) in the wxLogWindow constructor. This calls always wxLogWindow::OnFrameCreate and never OnFrameCreate in the derived class.

A look at 2.9.1 source shows the same problem.

See also:
http://www.parashift.com/c++-faq-lite/strange-inheritance.html
[23.5] When my base class's constructor calls a virtual function on its this object, why doesn't my derived class's override of that virtual function get invoked?

Change History (2)

comment:1 Changed 4 years ago by vadz

  • Component changed from base to GUI-all
  • Milestone set to 3.0
  • Priority changed from normal to low
  • Status changed from new to confirmed
  • Version changed from 2.8.10 to 2.9-svn

I think we should just remove this method, it doesn't seem very useful (you could just as well do whatever extra initialization you need after creating wxLogWindow) and making it work would require introducing 2 step creation for wxLogWindow which I'd rather avoid.

Any objections to removing it?

comment:2 Changed 20 months ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [73622]) Remove wxLogWindow::OnFrameCreate() virtual method.

This method couldn't be overridden by the classes deriving from wxLogWindow
because it was called (indirectly) from wxLogWindow ctor itself and so was
completely useless. Just remove it to avoid confusion.

Closes #12763.

Note: See TracTickets for help on using tickets.