From 80ca6661d45da449c20a922fbdb3fe32edfe9544 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 31 Oct 2017 17:50:25 +0100 Subject: [PATCH] Explain that wxProgressDialog should be created on the stack Creating it on the heap is unnecessary and can be actually harmful, so document explicitly that it shouldn't be done. See #17983. --- interface/wx/progdlg.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/interface/wx/progdlg.h b/interface/wx/progdlg.h index 78118681c4..6f7fb1681d 100644 --- a/interface/wx/progdlg.h +++ b/interface/wx/progdlg.h @@ -33,6 +33,23 @@ wxProgressDialog in a multi-threaded application you should be sure to use wxThreadEvent for your inter-threads communications). + Although wxProgressDialog is not really modal, it should be created on the + stack, and not the heap, as other modal dialogs, e.g. use it like this: + @code + void MyFrame::SomeFunc() + { + wxProgressDialog dialog(...); + for ( int i = 0; i < 100; ++i ) { + if ( !dialog.Update(i)) { + // Cancelled by user. + break; + } + + ... do something time-consuming (but not too much) ... + } + } + @endcode + @beginStyleTable @style{wxPD_APP_MODAL} Make the progress dialog modal. If this flag is not given, it is