Initialize wxMiniFrame::m_miniEdge before creating wxInfoDC Creating wxInfoDC results in wxMiniFrame::GetClientSize() being called (in order to determine the DC size), but this function uses m_miniEdge which hasn't been initialized yet. Move m_miniEdge initialization before m_miniTitle initialization to fix this and avoid sanitizer errors about using uninitialized field.
Initialize all wxMiniFrame members in their declarations Ensure that we never use uninitialized variables.
Avoid clang warning about unused dummy variable We really want to have it, even if it's not used.
Merge branch 'ubsan-fixes' Fix UBSAN errors in wxMiniFrame code.
Initialize wxStyledTextEvent members in their declarations No real changes, just initialize member variable when declaring them instead of doing it separately in the ctor.
Improve code showing wxOverlay use in the drawing sample Make the code work on all platforms by adding SetOpacity(-1) call needed under wxMSW to enable overlay transparency and using wxGCDC to take into account the brush transparency.
CMake: Improve creating Wayland protocol files Create the files in a temporary directory and only copy them to the final directory if the files are different. This prevents the source files from being rebuilt every time CMake is run and the protocol files are replaced. Exclude the protocols directory from being installed. Closes #25945.
Fix bug in wxString::AssignFromUTF8() in UTF-8 build This function, added in fd0c23ee24 (Add wxString::AssignFromUTF8() function, 2025-08-30), had a fatal bug as it didn't invalidate the position cache before modifying m_impl, which resulted in crashes later. See #25887.
| ... | ... | @@ -464,6 +464,7 @@ if(wxUSE_GUI) |
| 464 | 464 | pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
|
| 465 | 465 | if(WAYLAND_SCANNER)
|
| 466 | 466 | set(wx_protocols_input_dir ${wxSOURCE_DIR}/src/unix/protocols)
|
| 467 | + set(wx_protocols_temp_dir ${wxOUTPUT_DIR}/wx/protocols)
|
|
| 467 | 468 | set(wx_protocols_output_dir ${wxSETUP_HEADER_PATH}/wx/protocols)
|
| 468 | 469 | |
| 469 | 470 | # Note that we need multiple execute_process()
|
| ... | ... | @@ -471,19 +472,30 @@ if(wxUSE_GUI) |
| 471 | 472 | # concurrently and not sequentially.
|
| 472 | 473 | execute_process(
|
| 473 | 474 | COMMAND
|
| 474 | - ${CMAKE_COMMAND} -E make_directory ${wx_protocols_output_dir}
|
|
| 475 | + ${CMAKE_COMMAND} -E make_directory ${wx_protocols_temp_dir}
|
|
| 475 | 476 | )
|
| 476 | 477 | execute_process(
|
| 477 | 478 | COMMAND
|
| 478 | 479 | ${WAYLAND_SCANNER} client-header
|
| 479 | 480 | ${wx_protocols_input_dir}/pointer-warp-v1.xml
|
| 480 | - ${wx_protocols_output_dir}/pointer-warp-v1-client-protocol.h
|
|
| 481 | + ${wx_protocols_temp_dir}/pointer-warp-v1-client-protocol.h
|
|
| 481 | 482 | )
|
| 482 | 483 | execute_process(
|
| 483 | 484 | COMMAND
|
| 484 | 485 | ${WAYLAND_SCANNER} private-code
|
| 485 | 486 | ${wx_protocols_input_dir}/pointer-warp-v1.xml
|
| 486 | - ${wx_protocols_output_dir}/pointer-warp-v1-client-protocol.c
|
|
| 487 | + ${wx_protocols_temp_dir}/pointer-warp-v1-client-protocol.c
|
|
| 488 | + )
|
|
| 489 | + |
|
| 490 | + execute_process(
|
|
| 491 | + COMMAND
|
|
| 492 | + ${CMAKE_COMMAND} -E make_directory ${wx_protocols_output_dir}
|
|
| 493 | + )
|
|
| 494 | + execute_process(
|
|
| 495 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
| 496 | + ${wx_protocols_temp_dir}/pointer-warp-v1-client-protocol.h
|
|
| 497 | + ${wx_protocols_temp_dir}/pointer-warp-v1-client-protocol.c
|
|
| 498 | + ${wx_protocols_output_dir}
|
|
| 487 | 499 | )
|
| 488 | 500 | |
| 489 | 501 | set(wxHAVE_WAYLAND_CLIENT ON)
|
| ... | ... | @@ -53,7 +53,9 @@ if(WIN32_MSVC_NAMING) |
| 53 | 53 | else()
|
| 54 | 54 | install(
|
| 55 | 55 | DIRECTORY "${wxSETUP_HEADER_PATH}"
|
| 56 | - DESTINATION "${library_dir}/wx/include")
|
|
| 56 | + DESTINATION "${library_dir}/wx/include"
|
|
| 57 | + PATTERN "protocols" EXCLUDE
|
|
| 58 | + )
|
|
| 57 | 59 | |
| 58 | 60 | install(
|
| 59 | 61 | FILES "${wxOUTPUT_DIR}/wx/config/${wxBUILD_FILE_ID}"
|
| ... | ... | @@ -53,12 +53,12 @@ protected: |
| 53 | 53 | // implementation
|
| 54 | 54 | public:
|
| 55 | 55 | #ifndef __WXGTK4__
|
| 56 | - bool m_isDragMove;
|
|
| 56 | + bool m_isDragMove = false;
|
|
| 57 | 57 | wxSize m_dragOffset;
|
| 58 | 58 | #endif
|
| 59 | 59 | wxBitmap m_closeButton;
|
| 60 | - int m_miniEdge;
|
|
| 61 | - int m_miniTitle;
|
|
| 60 | + int m_miniEdge = 0;
|
|
| 61 | + int m_miniTitle = 0;
|
|
| 62 | 62 | };
|
| 63 | 63 | |
| 64 | 64 | #endif // _WX_GTK_MINIFRAME_H_ |
| ... | ... | @@ -6139,7 +6139,11 @@ private: |
| 6139 | 6139 | |
| 6140 | 6140 | class WXDLLIMPEXP_STC wxStyledTextEvent : public wxCommandEvent {
|
| 6141 | 6141 | public:
|
| 6142 | - wxStyledTextEvent(wxEventType commandType=0, int id=0);
|
|
| 6142 | + wxStyledTextEvent(wxEventType commandType = 0, int id = 0)
|
|
| 6143 | + : wxCommandEvent(commandType, id)
|
|
| 6144 | + {
|
|
| 6145 | + }
|
|
| 6146 | + |
|
| 6143 | 6147 | #ifndef SWIG
|
| 6144 | 6148 | wxStyledTextEvent(const wxStyledTextEvent& event);
|
| 6145 | 6149 | #endif
|
| ... | ... | @@ -6226,35 +6230,35 @@ public: |
| 6226 | 6230 | private:
|
| 6227 | 6231 | wxDECLARE_DYNAMIC_CLASS(wxStyledTextEvent);
|
| 6228 | 6232 | |
| 6229 | - int m_position;
|
|
| 6230 | - int m_key;
|
|
| 6231 | - int m_modifiers;
|
|
| 6233 | + int m_position = 0;
|
|
| 6234 | + int m_key = 0;
|
|
| 6235 | + int m_modifiers = 0;
|
|
| 6232 | 6236 | |
| 6233 | - int m_modificationType; // wxEVT_STC_MODIFIED
|
|
| 6234 | - int m_length;
|
|
| 6235 | - int m_linesAdded;
|
|
| 6236 | - int m_line;
|
|
| 6237 | - int m_foldLevelNow;
|
|
| 6238 | - int m_foldLevelPrev;
|
|
| 6237 | + int m_modificationType = 0; // wxEVT_STC_MODIFIED
|
|
| 6238 | + int m_length = 0;
|
|
| 6239 | + int m_linesAdded = 0;
|
|
| 6240 | + int m_line = 0;
|
|
| 6241 | + int m_foldLevelNow = 0;
|
|
| 6242 | + int m_foldLevelPrev = 0;
|
|
| 6239 | 6243 | |
| 6240 | - int m_margin; // wxEVT_STC_MARGINCLICK
|
|
| 6244 | + int m_margin = 0; // wxEVT_STC_MARGINCLICK
|
|
| 6241 | 6245 | |
| 6242 | - int m_message; // wxEVT_STC_MACRORECORD
|
|
| 6243 | - int m_wParam;
|
|
| 6244 | - int m_lParam;
|
|
| 6246 | + int m_message = 0; // wxEVT_STC_MACRORECORD
|
|
| 6247 | + int m_wParam = 0;
|
|
| 6248 | + int m_lParam = 0;
|
|
| 6245 | 6249 | |
| 6246 | - int m_listType;
|
|
| 6247 | - int m_x;
|
|
| 6248 | - int m_y;
|
|
| 6250 | + int m_listType = 0;
|
|
| 6251 | + int m_x = 0;
|
|
| 6252 | + int m_y = 0;
|
|
| 6249 | 6253 | |
| 6250 | - int m_token; // wxEVT_STC__MODIFIED with SC_MOD_CONTAINER
|
|
| 6251 | - int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION
|
|
| 6252 | - int m_updated; // wxEVT_STC_UPDATEUI
|
|
| 6253 | - int m_listCompletionMethod;
|
|
| 6254 | + int m_token = 0; // wxEVT_STC__MODIFIED with SC_MOD_CONTAINER
|
|
| 6255 | + int m_annotationLinesAdded = 0; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION
|
|
| 6256 | + int m_updated = 0; // wxEVT_STC_UPDATEUI
|
|
| 6257 | + int m_listCompletionMethod = 0;
|
|
| 6254 | 6258 | |
| 6255 | 6259 | #if wxUSE_DRAG_AND_DROP
|
| 6256 | - int m_dragFlags; // wxEVT_STC_START_DRAG
|
|
| 6257 | - wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
|
|
| 6260 | + int m_dragFlags = wxDrag_CopyOnly; // wxEVT_STC_START_DRAG
|
|
| 6261 | + wxDragResult m_dragResult = wxDragNone; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
|
|
| 6258 | 6262 | #endif
|
| 6259 | 6263 | #endif
|
| 6260 | 6264 | };
|
| ... | ... | @@ -1747,6 +1747,8 @@ public: |
| 1747 | 1747 | |
| 1748 | 1748 | void AssignFromUTF8Unchecked(const char *utf8, size_t len = npos)
|
| 1749 | 1749 | {
|
| 1750 | + wxSTRING_INVALIDATE_CACHE();
|
|
| 1751 | + |
|
| 1750 | 1752 | m_impl.assign(utf8, len == npos ? strlen(utf8) : len);
|
| 1751 | 1753 | }
|
| 1752 | 1754 | void AssignFromUTF8(const char *utf8, size_t len = npos)
|
| ... | ... | @@ -2310,18 +2310,21 @@ void MyCanvas::OnMouseMove(wxMouseEvent &event) |
| 2310 | 2310 | m_currentpoint = wxPoint( xx , yy ) ;
|
| 2311 | 2311 | wxRect newrect ( m_anchorpoint , m_currentpoint ) ;
|
| 2312 | 2312 | |
| 2313 | + // This is required with wxMSW to allow per-pixel transparency.
|
|
| 2314 | + m_overlay.SetOpacity(-1);
|
|
| 2315 | + |
|
| 2313 | 2316 | wxOverlayDC dc(m_overlay, this);
|
| 2314 | 2317 | PrepareDC(dc);
|
| 2315 | 2318 | |
| 2319 | + // Note: this must be called on the overlay DC, not wxGCDC.
|
|
| 2316 | 2320 | dc.Clear();
|
| 2317 | -#ifdef __WXMAC__
|
|
| 2318 | - dc.SetPen( *wxGREY_PEN );
|
|
| 2319 | - dc.SetBrush( wxColour( 192,192,192,64 ) );
|
|
| 2320 | -#else
|
|
| 2321 | - dc.SetPen( wxPen( *wxLIGHT_GREY, 2 ) );
|
|
| 2322 | - dc.SetBrush( *wxTRANSPARENT_BRUSH );
|
|
| 2323 | -#endif
|
|
| 2324 | - dc.DrawRectangle( newrect );
|
|
| 2321 | + |
|
| 2322 | + // Use wxGCDC to ensure that brush transparency is taken into account
|
|
| 2323 | + // even under wxMSW where plain wxDC doesn't support it.
|
|
| 2324 | + wxGCDC gdc(dc);
|
|
| 2325 | + gdc.SetPen( *wxGREY_PEN );
|
|
| 2326 | + gdc.SetBrush( wxColour( 192,192,192,64 ) );
|
|
| 2327 | + gdc.DrawRectangle( newrect );
|
|
| 2325 | 2328 | }
|
| 2326 | 2329 | #else
|
| 2327 | 2330 | wxUnusedVar(event);
|
| ... | ... | @@ -523,6 +523,7 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map) |
| 523 | 523 | // it might only have it in narrow char version until now as we use main()
|
| 524 | 524 | // (and not _wmain()) as our entry point.
|
| 525 | 525 | static wxChar* s_dummyEnvVar = _tgetenv(wxT("TEMP"));
|
| 526 | + wxUnusedVar(s_dummyEnvVar);
|
|
| 526 | 527 | |
| 527 | 528 | wxChar **env = _tenviron;
|
| 528 | 529 | #elif defined(__VMS)
|
| ... | ... | @@ -330,8 +330,11 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title |
| 330 | 330 | {
|
| 331 | 331 | wxFrame::Create( parent, id, title, pos, size, style, name );
|
| 332 | 332 | |
| 333 | - m_isDragMove = false;
|
|
| 334 | - m_miniTitle = 0;
|
|
| 333 | + if (style & wxRESIZE_BORDER)
|
|
| 334 | + m_miniEdge = 4;
|
|
| 335 | + else
|
|
| 336 | + m_miniEdge = 3;
|
|
| 337 | + |
|
| 335 | 338 | if (style & wxCAPTION)
|
| 336 | 339 | {
|
| 337 | 340 | wxInfoDC dc(this);
|
| ... | ... | @@ -339,11 +342,6 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title |
| 339 | 342 | m_miniTitle = wxMax(dc.GetTextExtent("X").y, 16);
|
| 340 | 343 | }
|
| 341 | 344 | |
| 342 | - if (style & wxRESIZE_BORDER)
|
|
| 343 | - m_miniEdge = 4;
|
|
| 344 | - else
|
|
| 345 | - m_miniEdge = 3;
|
|
| 346 | - |
|
| 347 | 345 | // don't allow sizing smaller than decorations
|
| 348 | 346 | int minWidth = 2 * m_miniEdge;
|
| 349 | 347 | int minHeight = 2 * m_miniEdge + m_miniTitle;
|
| ... | ... | @@ -6043,36 +6043,6 @@ WXLRESULT wxStyledTextCtrl::MSWWindowProc(WXUINT nMsg, |
| 6043 | 6043 | //----------------------------------------------------------------------
|
| 6044 | 6044 | //----------------------------------------------------------------------
|
| 6045 | 6045 | |
| 6046 | -wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
|
|
| 6047 | - : wxCommandEvent(commandType, id)
|
|
| 6048 | -{
|
|
| 6049 | - m_position = 0;
|
|
| 6050 | - m_key = 0;
|
|
| 6051 | - m_modifiers = 0;
|
|
| 6052 | - m_modificationType = 0;
|
|
| 6053 | - m_length = 0;
|
|
| 6054 | - m_linesAdded = 0;
|
|
| 6055 | - m_line = 0;
|
|
| 6056 | - m_foldLevelNow = 0;
|
|
| 6057 | - m_foldLevelPrev = 0;
|
|
| 6058 | - m_margin = 0;
|
|
| 6059 | - m_message = 0;
|
|
| 6060 | - m_wParam = 0;
|
|
| 6061 | - m_lParam = 0;
|
|
| 6062 | - m_listType = 0;
|
|
| 6063 | - m_x = 0;
|
|
| 6064 | - m_y = 0;
|
|
| 6065 | - m_token = 0;
|
|
| 6066 | - m_annotationLinesAdded = 0;
|
|
| 6067 | - m_updated = 0;
|
|
| 6068 | - m_listCompletionMethod = 0;
|
|
| 6069 | - |
|
| 6070 | -#if wxUSE_DRAG_AND_DROP
|
|
| 6071 | - m_dragFlags = wxDrag_CopyOnly;
|
|
| 6072 | - m_dragResult = wxDragNone;
|
|
| 6073 | -#endif
|
|
| 6074 | -}
|
|
| 6075 | - |
|
| 6076 | 6046 | bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
|
| 6077 | 6047 | bool wxStyledTextEvent::GetControl() const { return (m_modifiers & SCI_CTRL) != 0; }
|
| 6078 | 6048 | bool wxStyledTextEvent::GetAlt() const { return (m_modifiers & SCI_ALT) != 0; }
|
| ... | ... | @@ -1235,36 +1235,6 @@ WXLRESULT wxStyledTextCtrl::MSWWindowProc(WXUINT nMsg, |
| 1235 | 1235 | //----------------------------------------------------------------------
|
| 1236 | 1236 | //----------------------------------------------------------------------
|
| 1237 | 1237 | |
| 1238 | -wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
|
|
| 1239 | - : wxCommandEvent(commandType, id)
|
|
| 1240 | -{
|
|
| 1241 | - m_position = 0;
|
|
| 1242 | - m_key = 0;
|
|
| 1243 | - m_modifiers = 0;
|
|
| 1244 | - m_modificationType = 0;
|
|
| 1245 | - m_length = 0;
|
|
| 1246 | - m_linesAdded = 0;
|
|
| 1247 | - m_line = 0;
|
|
| 1248 | - m_foldLevelNow = 0;
|
|
| 1249 | - m_foldLevelPrev = 0;
|
|
| 1250 | - m_margin = 0;
|
|
| 1251 | - m_message = 0;
|
|
| 1252 | - m_wParam = 0;
|
|
| 1253 | - m_lParam = 0;
|
|
| 1254 | - m_listType = 0;
|
|
| 1255 | - m_x = 0;
|
|
| 1256 | - m_y = 0;
|
|
| 1257 | - m_token = 0;
|
|
| 1258 | - m_annotationLinesAdded = 0;
|
|
| 1259 | - m_updated = 0;
|
|
| 1260 | - m_listCompletionMethod = 0;
|
|
| 1261 | - |
|
| 1262 | -#if wxUSE_DRAG_AND_DROP
|
|
| 1263 | - m_dragFlags = wxDrag_CopyOnly;
|
|
| 1264 | - m_dragResult = wxDragNone;
|
|
| 1265 | -#endif
|
|
| 1266 | -}
|
|
| 1267 | - |
|
| 1268 | 1238 | bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
|
| 1269 | 1239 | bool wxStyledTextEvent::GetControl() const { return (m_modifiers & SCI_CTRL) != 0; }
|
| 1270 | 1240 | bool wxStyledTextEvent::GetAlt() const { return (m_modifiers & SCI_ALT) != 0; }
|
| ... | ... | @@ -661,7 +661,11 @@ private: |
| 661 | 661 | |
| 662 | 662 | class WXDLLIMPEXP_STC wxStyledTextEvent : public wxCommandEvent {
|
| 663 | 663 | public:
|
| 664 | - wxStyledTextEvent(wxEventType commandType=0, int id=0);
|
|
| 664 | + wxStyledTextEvent(wxEventType commandType = 0, int id = 0)
|
|
| 665 | + : wxCommandEvent(commandType, id)
|
|
| 666 | + {
|
|
| 667 | + }
|
|
| 668 | + |
|
| 665 | 669 | #ifndef SWIG
|
| 666 | 670 | wxStyledTextEvent(const wxStyledTextEvent& event);
|
| 667 | 671 | #endif
|
| ... | ... | @@ -748,35 +752,35 @@ public: |
| 748 | 752 | private:
|
| 749 | 753 | wxDECLARE_DYNAMIC_CLASS(wxStyledTextEvent);
|
| 750 | 754 | |
| 751 | - int m_position;
|
|
| 752 | - int m_key;
|
|
| 753 | - int m_modifiers;
|
|
| 755 | + int m_position = 0;
|
|
| 756 | + int m_key = 0;
|
|
| 757 | + int m_modifiers = 0;
|
|
| 754 | 758 | |
| 755 | - int m_modificationType; // wxEVT_STC_MODIFIED
|
|
| 756 | - int m_length;
|
|
| 757 | - int m_linesAdded;
|
|
| 758 | - int m_line;
|
|
| 759 | - int m_foldLevelNow;
|
|
| 760 | - int m_foldLevelPrev;
|
|
| 759 | + int m_modificationType = 0; // wxEVT_STC_MODIFIED
|
|
| 760 | + int m_length = 0;
|
|
| 761 | + int m_linesAdded = 0;
|
|
| 762 | + int m_line = 0;
|
|
| 763 | + int m_foldLevelNow = 0;
|
|
| 764 | + int m_foldLevelPrev = 0;
|
|
| 761 | 765 | |
| 762 | - int m_margin; // wxEVT_STC_MARGINCLICK
|
|
| 766 | + int m_margin = 0; // wxEVT_STC_MARGINCLICK
|
|
| 763 | 767 | |
| 764 | - int m_message; // wxEVT_STC_MACRORECORD
|
|
| 765 | - int m_wParam;
|
|
| 766 | - int m_lParam;
|
|
| 768 | + int m_message = 0; // wxEVT_STC_MACRORECORD
|
|
| 769 | + int m_wParam = 0;
|
|
| 770 | + int m_lParam = 0;
|
|
| 767 | 771 | |
| 768 | - int m_listType;
|
|
| 769 | - int m_x;
|
|
| 770 | - int m_y;
|
|
| 772 | + int m_listType = 0;
|
|
| 773 | + int m_x = 0;
|
|
| 774 | + int m_y = 0;
|
|
| 771 | 775 | |
| 772 | - int m_token; // wxEVT_STC__MODIFIED with SC_MOD_CONTAINER
|
|
| 773 | - int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION
|
|
| 774 | - int m_updated; // wxEVT_STC_UPDATEUI
|
|
| 775 | - int m_listCompletionMethod;
|
|
| 776 | + int m_token = 0; // wxEVT_STC__MODIFIED with SC_MOD_CONTAINER
|
|
| 777 | + int m_annotationLinesAdded = 0; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION
|
|
| 778 | + int m_updated = 0; // wxEVT_STC_UPDATEUI
|
|
| 779 | + int m_listCompletionMethod = 0;
|
|
| 776 | 780 | |
| 777 | 781 | #if wxUSE_DRAG_AND_DROP
|
| 778 | - int m_dragFlags; // wxEVT_STC_START_DRAG
|
|
| 779 | - wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
|
|
| 782 | + int m_dragFlags = wxDrag_CopyOnly; // wxEVT_STC_START_DRAG
|
|
| 783 | + wxDragResult m_dragResult = wxDragNone; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
|
|
| 780 | 784 | #endif
|
| 781 | 785 | #endif
|
| 782 | 786 | };
|
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help