Fix crash when using wxNotebook with glib 2.73 or later
Make GTK notebook log suppression opt-in to avoid a fatal error when the application calls g_log_set_writer_func() itself, as doing it more than once immediately kills the application with glib 2.73 and there is no way to check if it had been already done or not (you have to admire the purity of the API design here). This is unfortunate as 99% of the wxWidgets applications that do _not_ call g_log_set_writer_func() would now show the spurious diagnostics by default again, but preferable to making the remaining 1% crash, and there doesn't seem to be any other solution. Call the new GTKAllowDiagnosticsControl() function in the notebook sample to at least still avoid getting the spurious diagnostic messages described in #22176 there. See #22717,.
This commit is contained in:
parent
82cb8aa859
commit
8af645ed22
6 changed files with 65 additions and 1 deletions
|
|
@ -1061,6 +1061,25 @@ public:
|
|||
*/
|
||||
static void GTKSuppressDiagnostics(int flags = -1);
|
||||
|
||||
/**
|
||||
Allows wxWidgets to selectively suppress some GTK messages.
|
||||
|
||||
This function can be called to allow wxWidgets to control GTK message
|
||||
logging. You must @e not call it if your application calls the @c
|
||||
g_log_set_writer_func() function itself, as this function can be only
|
||||
called once.
|
||||
|
||||
It is recommended to call this function in your overridden version of
|
||||
wxApp::OnInit() to allow wxWidgets to suppress some spurious GTK error
|
||||
messages, e.g. the ones that happen whenever wxNotebook pages are
|
||||
removed with the current GTK versions.
|
||||
|
||||
@onlyfor{wxgtk}
|
||||
|
||||
@since 3.2.1
|
||||
*/
|
||||
static void GTKAllowDiagnosticsControl();
|
||||
|
||||
///@}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -145,6 +145,10 @@ public:
|
|||
|
||||
/**
|
||||
Destroys the wxNotebook object.
|
||||
|
||||
@note When using wxGTK, destroying notebook can result in spurious GTK
|
||||
diagnostic messages, you may use wxApp::GTKAllowDiagnosticsControl() to
|
||||
suppress them.
|
||||
*/
|
||||
virtual ~wxNotebook();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue