Don't use non-POD type as variadic argument

Implicit conversion from QByteArray to const char* works for most gtk
functions. But gtk_file_chooser_dialog_new() uses varargs and passing
the non-POD QByteArray through varargs does not work (it's UB).

Task-number: QTBUG-59763
Change-Id: I85f9323d99342896e6921cdeb85f5a1af7377b4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Tobias Sung 2017-03-31 17:08:50 +02:00 committed by Thiago Macieira
parent 88a8feeacb
commit 507223a218

View File

@ -245,8 +245,8 @@ QGtk3FileDialogHelper::QGtk3FileDialogHelper()
{
d.reset(new QGtk3Dialog(gtk_file_chooser_dialog_new("", 0,
GTK_FILE_CHOOSER_ACTION_OPEN,
standardButtonText(QPlatformDialogHelper::Cancel), GTK_RESPONSE_CANCEL,
standardButtonText(QPlatformDialogHelper::Ok), GTK_RESPONSE_OK,
standardButtonText(QPlatformDialogHelper::Cancel).constData(), GTK_RESPONSE_CANCEL,
standardButtonText(QPlatformDialogHelper::Ok).constData(), GTK_RESPONSE_OK,
NULL)));
connect(d.data(), SIGNAL(accept()), this, SLOT(onAccepted()));