Containers and parentage
Posted: Tue Sep 01 2020 12:15 pm
Perhaps I'm just having a brain fart? Perhaps I had a brain fart the other day when I left a comment in the code that sent me down this path this morning.
Given all of the changes when forking from Qt, do all of the containers provide parentage? The documentation is not clear. If most things are now wrappers for STL implementations which have no concept of parentage, then I have to ask . . . do all of these containers assume parentage of the objects they contain? No exceptions, no gotcha's, no "on Thursdays when it rains and Fred's at the keyboard" situations.
I had a comment a comment in the Diamond code near a section like this
Wondering if I could still be certain the "new SyntaxPatters()" object would be parented by the QMap m_syntaxPatters. Not as straight forward as it sounds because SyntaxPatterns is a gadget.
I decided to dig into this comment when I discovered my non-parented QObject based singleton class Overlord wasn't getting its destructor called on the way out. I don't remember seeing that before. I seem to always remember that as long as it was a QObject based object, parented or not, as long as it was created _after_ QApplication it got cleaned up on the way out the door. Perhaps I just have faulty memory?
Anyway, I would like some clarification/documentation on this issue.
Thank you.
Given all of the changes when forking from Qt, do all of the containers provide parentage? The documentation is not clear. If most things are now wrappers for STL implementations which have no concept of parentage, then I have to ask . . . do all of these containers assume parentage of the objects they contain? No exceptions, no gotcha's, no "on Thursdays when it rains and Fred's at the keyboard" situations.
I had a comment a comment in the Diamond code near a section like this
Code: Select all
if ( m_settings.m_options.preloadClipper() )
{
fileName = m_settings.syntaxPath() + "syn_clipper.json";
m_syntaxPatterns[fileName] = new SyntaxPatterns( fileName );
}
Code: Select all
class SyntaxPatterns
{
CS_GADGET( SyntaxPatterns )
public:
SyntaxPatterns( QString fileName );
SyntaxPatterns( const SyntaxPatterns &patterns );
SyntaxPatterns &operator = ( const SyntaxPatterns &other );
QStringList key_Patterns;
QStringList class_Patterns;
QStringList func_Patterns;
QStringList type_Patterns;
QStringList constant_Patterns;
QString commentSingle;
QString commentStart;
QString commentEnd;
QString pattern_file;
bool ignoreCase;
private:
QByteArray readSyntaxFile();
};
Anyway, I would like some clarification/documentation on this issue.
Thank you.