Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#15881 closed enhancement (fixed)

Typo in documentation of wxEvtHandler::QueueEvent () code example

Reported by: PB Owned by:
Priority: lowest Milestone:
Component: documentation Version: 3.0.0
Keywords: Cc:
Blocked By: Blocking:
Patch: yes


Example of using wxThreadEvent in wxEvtHandler::QueueEvent () documentation:

void FunctionInAWorkerThread(const wxString& str)
    wxThreadEvent evt;

    // wxThreadEvent::Clone() makes sure that the internal wxString
    // member is not shared by other wxString instances:
    wxTheApp->QueueEvent( evt.Clone() );

evt is not a pointer, so it should be


By the way, speaking about threads and documentation... In the sample code of wxThread documentation, there is

  wxCriticalSectionLocker enter(m_pHandler->m_pThreadCS);
  // the thread is being destroyed; make sure not to leave dangling pointers around
  m_pHandler->m_pThread = NULL;

m_pThread is a protected variable of m_pHandler (MyFrame instance) and therefore inaccessible to MyThread. I am not sure how to fix it, so I won't make a ticket about it.

Attachments (1)

event.h.patch download (545 bytes) - added by PB 4 years ago.
Fixes a typo in wxEvtHandler::QueueEvent () code example

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by PB

Fixes a typo in wxEvtHandler::QueueEvent () code example

comment:1 Changed 4 years ago by VZ

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

(In [75636]) Fix syntax error in the QueueEvent() documentation example.

Use ".", not "->", on the object.

Closes #15881.

comment:2 Changed 4 years ago by VZ

(In [75637]) Compilation fix for the example in wxThread documentation.

Make MyThread a friend to allow it accessing the private fields of MyFrame.

Notice that this example still remains badly written and should be ideally
entirely redone using conditions and mutexes.

See #15881.

Note: See TracTickets for help on using tickets.