VirtualBox

Changeset 99458 in vbox


Ignore:
Timestamp:
Apr 19, 2023 12:54:19 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156929
Message:

/Config.kmk,FE/Qt: Issue warning if using Qt debug build w/o also setting VBOX_WITH_DEBUG_VCC_CRT. Reverted incorrect QPointer hack.

Location:
trunk
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r99445 r99458  
    37553755endif
    37563756ifdef VBOX_WITH_DEBUG_VCC_CRT
    3757  VBOX_VCC_CRT_TYPE   = d
    3758  VBOX_VCC_CRT_TYPE_N =
     3757 VBOX_VCC_CRT_TYPE       := d
     3758 VBOX_VCC_CRT_TYPE_UPPER := D
     3759 VBOX_VCC_CRT_TYPE_N     :=
    37593760else
    3760  VBOX_VCC_CRT_TYPE   =
    3761  VBOX_VCC_CRT_TYPE_N = d
     3761 VBOX_VCC_CRT_TYPE       :=
     3762 VBOX_VCC_CRT_TYPE_UPPER :=
     3763 VBOX_VCC_CRT_TYPE_N     := d
    37623764endif
    37633765
     
    61076109 TEMPLATE_VBoxR3Exe_RCDEFS             = VBOX_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000)
    61086110 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
    6109   TEMPLATE_VBoxR3Exe_SDKS              = ReorderCompilerIncs WINSDK10-UCRT $(VBOX_WINPSDK)
     6111  TEMPLATE_VBoxR3Exe_SDKS              = ReorderCompilerIncs WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER) $(VBOX_WINPSDK)
    61106112 else
    61116113  TEMPLATE_VBoxR3Exe_SDKS              = ReorderCompilerIncs $(VBOX_WINPSDK)
     
    64376439 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
    64386440  ifdef VBOX_WITH_NOCRT_STATIC
    6439    TEMPLATE_VBoxR3StaticBase_SDKS          = $(subst WINSDK10-UCRT,,$(TEMPLATE_VBoxR3Exe_SDKS))
     6441   TEMPLATE_VBoxR3StaticBase_SDKS          = $(subst WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER),,$(TEMPLATE_VBoxR3Exe_SDKS))
    64406442  else
    6441    TEMPLATE_VBoxR3StaticBase_SDKS          = $(subst WINSDK10-UCRT, WINSDK10-UCRT-STATIC,$(TEMPLATE_VBoxR3Exe_SDKS))
     6443   TEMPLATE_VBoxR3StaticBase_SDKS          = $(subst WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER), WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC,$(TEMPLATE_VBoxR3Exe_SDKS))
    64426444  endif
    64436445 endif
     
    66696671TEMPLATE_VBoxR3StaticNoCrt               = Static
    66706672TEMPLATE_VBoxR3StaticNoCrt_EXTENDS       = VBoxR3Static
    6671 TEMPLATE_VBoxR3StaticNoCrt_SDKS          = $(subst WINSDK10-UCRT-STATIC,WINSDK10-UCRT-INCS, $(TEMPLATE_VBoxR3Static_SDKS))
     6673TEMPLATE_VBoxR3StaticNoCrt_SDKS          = $(subst WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC,WINSDK10-UCRT-INCS, $(TEMPLATE_VBoxR3Static_SDKS))
    66726674TEMPLATE_VBoxR3StaticNoCrt_SDKS.$(KBUILD_TARGET_ARCH) = $(filter-out VBoxOpenSslStatic,$(TEMPLATE_VBoxR3Static_SDKS.$(KBUILD_TARGET_ARCH)))
    66736675TEMPLATE_VBoxR3StaticNoCrt_DEFS          = $(TEMPLATE_VBoxR3Static_DEFS) \
     
    70537055 TEMPLATE_VBoxMainExe_TOOL.win.amd64     = $(VBOX_VCC_TOOL_STEM)AMD64
    70547056 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
    7055   TEMPLATE_VBoxMainExe_SDKS              = ReorderCompilerIncs WINSDK10-UCRT $(VBOX_WINPSDK) $(VBOX_WINDDK)
     7057  TEMPLATE_VBoxMainExe_SDKS              = ReorderCompilerIncs WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER) $(VBOX_WINPSDK) $(VBOX_WINDDK)
    70567058 else
    70577059  TEMPLATE_VBoxMainExe_SDKS              = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
     
    76327634 endif
    76337635
     7636 if "$(VBOX_QT_DBG)" != "" && "$(VBOX_QT_DBG)" != "$(VBOX_VCC_CRT_TYPE)" && "$(KBUILD_TARGET)" == "win"
     7637  $(warning WARNING! VBOX_QT_DBG (=$(VBOX_QT_DBG)) and VBOX_VCC_CRT_TYPE (=$(VBOX_VCC_CRT_TYPE)) does not match!)
     7638  $(warning WARNING! This may cause heap troubles in the GUI in places where something is)
     7639  $(warning WARNING! allocated in the Qt DLLs freed in our code (or vice versa) because they)
     7640  $(warning WARNING! will be using different allocators.  See r156914 for more details.)
     7641  $(warning WARNING! VBOX_WITH_DEBUG_VCC_CRT=1 in enabled debug CRT.)
     7642 endif
     7643
    76347644 ifeq ($(KBUILD_TARGET),darwin)
    76357645  VBOX_QT_MOD := QtCore QtGui QtWidgets QtPrintSupport
     
    77137723
    77147724 ifeq ($(KBUILD_TARGET),win)
    7715   # Note! No use of VBOX_VCC_CRT_TYPE here yet as it requires a /MDd build of Qt as well.
     7725  # Note! Only use VBOX_VCC_CRT_TYPE when it matches VBOX_QT_DBG.
    77167726  TEMPLATE_VBoxQtGuiExe_TOOL = $(VBOX_VCC_TOOL)
    77177727  if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
    7718    TEMPLATE_VBoxQtGuiExe_SDKS = WINSDK10-UCRT
     7728   TEMPLATE_VBoxQtGuiExe_SDKS = WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)
    77197729  endif
    77207730  TEMPLATE_VBoxQtGuiExe_DEFS += \
     
    77227732        QT_DLL _CRT_SECURE_NO_DEPRECATE \
    77237733        $(QMAKE_PRL_DEFINES)
    7724   TEMPLATE_VBoxQtGuiExe_CXXFLAGS = -nologo -Zm200 -MD -Zi -EHsc -Zc:wchar_t- $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS) $(VBOX_VCC_std)
     7734  TEMPLATE_VBoxQtGuiExe_CXXFLAGS = -nologo -Zm200 -MD$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),) \
     7735        -Zi -EHsc -Zc:wchar_t- $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS) $(VBOX_VCC_std)
    77257736  #    -wd4481: nonstandard extension used: override specifier 'override'
    77267737  #    -wd4625: 'QRubberBand' : copy constructor could not be generated because a base class copy constructor is inaccessible
     
    77877798        $(VBOX_LIBS_QT) \
    77887799        $(LIB_RUNTIME) \
    7789         $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/vcruntime.lib \
    7790         $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
    7791         $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
     7800        $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/vcruntime$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \
     7801        $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \
     7802        $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \
    77927803        $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
    77937804        $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib
     
    78017812        $(VBOX_LIBS_QT) \
    78027813        $(LIB_RUNTIME) \
    7803         $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
    7804         $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
     7814        $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \
     7815        $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt$(if-expr "$(VBOX_QT_DBG)" == "$(VBOX_VCC_CRT_TYPE)",$(VBOX_VCC_CRT_TYPE),).lib \
    78057816        $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
    78067817        $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib
     
    79247935 # Add COM/XPCOM stuff
    79257936 TEMPLATE_VBoxQtGuiExe_LIBS += \
    7926         $(PATH_STAGE_LIB)/VBoxCOM$(if-expr defined(VBOX_WITH_DEBUG_VCC_CRT) && $(KBUILD_TARGET) == win,-GUI,)$(VBOX_SUFF_LIB)
     7937        $(PATH_STAGE_LIB)/VBoxCOM$(if-expr "$(VBOX_QT_DBG)" != "$(VBOX_VCC_CRT_TYPE)" && $(KBUILD_TARGET) == win,-GUI,)$(VBOX_SUFF_LIB)
    79277938 ifdef VBOX_WITH_XPCOM
    79287939  ## @todo may be worth creating the VBOX_XPCOM SDK def, or just a SDK_VBOXXPCOM.
     
    80688079 TEMPLATE_VBoxBldProg_TOOL              := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_HOST_ARCH))
    80698080 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140"
    8070   TEMPLATE_VBoxBldProg_SDKS             := ReorderCompilerIncs WINSDK10-UCRT-STATIC $(VBOX_WINPSDK)
     8081  TEMPLATE_VBoxBldProg_SDKS             := ReorderCompilerIncs WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC $(VBOX_WINPSDK)
    80718082 else
    80728083  TEMPLATE_VBoxBldProg_SDKS             := ReorderCompilerIncs $(VBOX_WINPSDK)
     
    83328343   TEMPLATE_VBoxGuestR3ExeBase_SDKS    = ReorderCompilerIncs $(VBOX_WINPSDK_GST) VBoxNtDll
    83338344  else
    8334    TEMPLATE_VBoxGuestR3ExeBase_SDKS    = ReorderCompilerIncs WINSDK10-UCRT-STATIC $(VBOX_WINPSDK_GST) VBoxNtDll
     8345   TEMPLATE_VBoxGuestR3ExeBase_SDKS    = ReorderCompilerIncs WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC $(VBOX_WINPSDK_GST) VBoxNtDll
    83358346  endif
    83368347 else
     
    86078618TEMPLATE_VBoxGuestR3NoCrtExe                := ...
    86088619TEMPLATE_VBoxGuestR3NoCrtExe_EXTENDS        := VBoxGuestR3Exe
    8609 TEMPLATE_VBoxGuestR3NoCrtExe_SDKS            = $(subst WINSDK10-UCRT-STATIC,WINSDK10-UCRT-INCS, $(TEMPLATE_VBoxGuestR3Exe_SDKS))
     8620TEMPLATE_VBoxGuestR3NoCrtExe_SDKS            = $(subst WINSDK10-UCRT$(VBOX_VCC_CRT_TYPE_UPPER)-STATIC,WINSDK10-UCRT-INCS, $(TEMPLATE_VBoxGuestR3Exe_SDKS))
    86108621TEMPLATE_VBoxGuestR3NoCrtExe_SDKS.$(KBUILD_TARGET_ARCH) = $(filter-out VBoxOpenSslStatic,$(TEMPLATE_VBoxGuestR3Exe_SDKS.$(KBUILD_TARGET_ARCH)))
    86118622TEMPLATE_VBoxGuestR3NoCrtExe_DEFS            = $(TEMPLATE_VBoxGuestR3Exe_DEFS) \
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r99447 r99458  
    20592059
    20602060
    2061 if 0
    2062  #
    2063  # Testcase for the delete QPointer<> var issue.
    2064  #
    2065  PROGRAMS += tstQPointer
    2066  tstQPointer_TEMPLATE      := VBoxQtGuiExe
    2067  tstQPointer_QT_MODULES    := Core Widgets
    2068  tstQPointer_SOURCES       := src/tstQPointer.cpp
    2069 endif
    2070 
    2071 
    20722061#
    20732062# Doxygen documentation.
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r99448 r99458  
    23692369
    23702370    /* Delete message-box: */
    2371 #if 1 /* With a debug Qt 5.15.2 (r175) build and paged heap on windows, the ~QPointer destructor will trigger heap corruption
    2372          (VERIFIER STOP 0000000000000010: pid 0x253C: corrupted start stamp).  Clearing the QPointer prior to deletion works
    2373          around the issue (calling clear() after delete just triggers the problem a few lines earlier).
    2374 
    2375          Update: The issue is using different allocator and free heap routines.   When using a debug Qt build on windows,
    2376                  it is linked against the debug runtime DLL (ucrtbased.dll), while this code is still using the release
    2377                  runtime DLL (ucrtbase.dll).  The QtSharedPointer::ExternalRefCountData instance is allocated by
    2378                  Qt5CoreVBoxd!QtSharedPointer::ExternalRefCountData::getAndRef() using the debug heap allocator, which adds
    2379                  an additional 48 byte header on the object.  When we delete and the clear/destroy the QPointer instance
    2380                  here, we'll be doing the freeing, but since we don't link with ucrtbased.dll, we'll use the regular
    2381                  heap routines that doesn't expect a 48 byte header and they probably think we're handing them a garbage
    2382                  pointer.
    2383 
    2384                  The workaround here, moves the deleting of the QtSharedPointer::ExternalRefCountData structure from
    2385                  this module to the QObject destructor, which lives in the same module as where it was allocated and
    2386                  will be using the same allocator.  So, either we subclass the QPointer<> template and formalize this
    2387                  pattern a bit better, so a workaround can be done in one place, or we do some build time / makefile
    2388                  checks for this and forces the use of the debug CRT for the whole of VBox as well (not all that tempting)... */
    2389     QIMessageBox *pSafe = pMessageBox;
    2390     pMessageBox.clear();
    2391     if (pSafe)
    2392         delete pSafe;
    2393 #else
    23942371    delete pMessageBox;
    2395 #endif
    23962372
    23972373    /* Return result-code: */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette