[cmake-developers] [CMake 0014319]: Access before VARIABLE_WATCH crashes GUI on second Configure

Mantis Bug Tracker mantis at public.kitware.com
Mon Jul 29 10:42:15 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14319 
====================================================================== 
Reported By:                Peter Boettcher
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14319
Category:                   QtDialog
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-07-29 10:42 EDT
Last Modified:              2013-07-29 10:42 EDT
====================================================================== 
Summary:                    Access before VARIABLE_WATCH crashes GUI on second
Configure
Description: 
Repeatable qt-dialog crash: set a variable, then add a watch.  On second and
following Configure (in the same session), the set() accesses invalid memory,
and crashes the GUI about 20% of the time.  valgrind shows the bad access on
every run after the first.

Analysis: The VARIABLE_WATCH command object itself is used as the client_data
for the cmVariableWatchCommandVariableAccessed callback function, but the
WatchCommand data structures do not own this data.  When a second Configure is
run, the generator is torn down, which deletes the cmVariableWatchCommand
object.  The list of watches is not deleted however, so the next SET() triggers
the watch and tries to access the deleted cmVariableWatchCommand through the
callback data.


Steps to Reproduce: 
CMakeLists.txt:

SET(MYVAR 0)
VARIABLE_WATCH(MYVAR)

Run cmake-gui and click "Configure" until crash.  Or, run cmake-gui in valgrind,
and watch for invalid access on second Configure.


Additional Information: 
Repeatable on at least Linux with Makefiles, and Windows with Visual Studio
generator.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-07-29 10:42 Peter BoettcherNew Issue                                    
======================================================================




More information about the cmake-developers mailing list