Skip to content
Snippets Groups Projects
  • BtbN's avatar
    dfa2d992
    Make application quit on main window close · dfa2d992
    BtbN authored
    This causes the main window to signal the application to exit and delete
    its own pointer on close.  This fixes an issue where apparently some
    windows that aren't explicitly connected to the main window would be
    left open when the main window was closed because by default Qt will
    only exit when all windows have been closed.
    
    Because it deletes its own pointer, instead of storing it in a
    std::unique_ptr, use a QPointer because it has an internal mechanism for
    automatically tracking QObject deletion even if the deletion was not
    done on the QPointer itself, where as unique_ptr does not have that
    functionality.  In other words, if the pointer is deleted elsewhere for
    whatever reason, the QPointer will still set that internal pointer value
    to null.
    
    (message and minor modificiations by Jim)
    dfa2d992
    History
    Make application quit on main window close
    BtbN authored
    This causes the main window to signal the application to exit and delete
    its own pointer on close.  This fixes an issue where apparently some
    windows that aren't explicitly connected to the main window would be
    left open when the main window was closed because by default Qt will
    only exit when all windows have been closed.
    
    Because it deletes its own pointer, instead of storing it in a
    std::unique_ptr, use a QPointer because it has an internal mechanism for
    automatically tracking QObject deletion even if the deletion was not
    done on the QPointer itself, where as unique_ptr does not have that
    functionality.  In other words, if the pointer is deleted elsewhere for
    whatever reason, the QPointer will still set that internal pointer value
    to null.
    
    (message and minor modificiations by Jim)