QString crash when moving across a plugin boundary
General and Desktop
1
Posts
1
Posters
842
Views
1
Watching
-
Recently I noticed the following:
- In my application there is a 'core' bit, which has a certain function that accepts a
const QString&, sayf(const QString&)(it's actually a function that will popup aQFileDialogand the string is the caption) - The application loads plugins, and the plugins get access to this function
f - Recently I was calling this function from within the plugin, without explicitly typing a
QString, so I was callingf("File Dialog Caption")- in other words, I tried relying on implicit construction - This caused a crash in the core part, where, as far as I could tell, the internal data of the
QStringobject was pointing toNULL - Then I changed the call by explicitly calling the
QStringconstructor:f(QString("File Dialog Caption")), which resolved this crash
I'm (almost) sure this has something to do with the magic that happens when moving across dynamic libraries (this is on Windows, but I read that similar problems occur on *nix)
So, can someone explain (or refer to some clear explanation) about this magic? I have been googling quite a bit, but I find it hard to get details about what is happening. Then the obvious next question is, what is the connection with
QString? - In my application there is a 'core' bit, which has a certain function that accepts a