Opened 5 years ago

Closed 5 years ago

#11526 closed defect (fixed)

wxLogWindow assertion FAIL, with WXWIN_COMPATIBILITY_2_8==0

Reported by: vladius Owned by:
Priority: normal Milestone:
Component: GUI-generic Version: stable-latest
Keywords: log assertion failure Cc:
Blocked By: Blocking:
Patch: no

Description

Assuming no previous loggers were created, the following code:

new wxLogWindow(mainFrame, wxT("LOG"));

wxLogMessage(wxT("TEST"));

generates the following assertion failure:

Debug: ../src/common/log.cpp(449): assert "Assert failure" failed in DoLogText(): must be overridden if it is called

Change History (6)

comment:1 Changed 5 years ago by vadz

  • Status changed from new to infoneeded_new

I don't see this with

  • samples/minimal/minimal.cpp

    diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp
    index 80bf766..a9987d2 100644
    a b MyFrame::MyFrame(const wxString& title) 
    172172    CreateStatusBar(2); 
    173173    SetStatusText("Welcome to wxWidgets!"); 
    174174#endif // wxUSE_STATUSBAR 
     175 
     176    new wxLogWindow(this, "log"); 
    175177} 
    176178 
    177179 
    void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) 
    185187 
    186188void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) 
    187189{ 
     190    wxLogMessage("test message"); 
     191    return; 
    188192    wxMessageBox(wxString::Format 
    189193                 ( 
    190194                    "Welcome to %s!\n" 

Can you please attach a patch allowing to reproduce the problem?

comment:2 Changed 5 years ago by vladius

  • Status changed from infoneeded_new to new

How can I create such nice-looking embedded diffs?

The exact code to produce the error:

frame->Show(true);

new wxLogWindow(frame, wxT("LOG"));

wxLogMessage(wxT("TEST"));

comment:3 Changed 5 years ago by vladius

Even in the case of a diff, presented by you, I got the same failed assertion. Here are my configure options: ../configure CFLAGS=-fno-omit-frame-pointer CXXFLAGS=-fno-omit-frame-pointer --disable-compat28 --with-opengl --disable-shared --enable-monolithic --with-libpng=builtin --with-libjpeg=builtin --with-zlib=builtin --with-expat=builtin --with-libtiff=builtin --enable-debug

comment:4 follow-up: Changed 5 years ago by vladius

Ok, further investigation showed that it is "--disable-compat28" flag that causes the failure. I have compiled a build without this flag and it works just fine. Still, is it an expected behavior?

comment:5 in reply to: ↑ 4 Changed 5 years ago by vadz

  • Status changed from new to confirmed
  • Summary changed from wxLogWindow assertion FAIL, to wxLogWindow assertion FAIL, with WXWIN_COMPATIBILITY_2_8==0

Replying to vladius:

Ok, further investigation showed that it is "--disable-compat28" flag that causes the failure.

Thanks for debugging this, I see the problem now.

I have compiled a build without this flag and it works just fine. Still, is it an expected behavior?

No, of course not. Will fix soon, thanks for reporting.

comment:6 Changed 5 years ago by VZ

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

(In [63167]) Don't call base class version unnecessarily in wxLogWindow::DoLogTextAtLevel().

This is unnecessary as the log message is already passed to the previous
logger by the base class wxLogChain::DoLogRecord() implementation. Worse, it's
actively harmful as it resulted in asserts in wxLog::DoLogText() when built
with WXWIN_COMPATIBILITY_2_8==0.

Closes #11526.

Note: See TracTickets for help on using tickets.