Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.9.0
-
None
-
Visual Studio 17.13.6 (latest as of this report), building in C++23 mode
Description
This function returns NULL on Windows. It works as expected on Mac and GNU/Linux.
std::string get_for_filename () { QDateTime datetime = QDateTime::currentDateTime (); QString str_datetime = datetime.toString (QString::fromUtf8 ("yyyy-MM-dd_HH-mm-ss")); return str_datetime.toStdString (); }
I stepped through the debugger in visual studio and I can see the correct string value inside my `str_datetime` variable. The result of this function is NULL according to the debugger, and I also get a memory-related fatal error when I attempt to use that result.
If I change the last line to `return str_datetime.toUtf8 ().data ();` then this function returns the expected string and everything works.