PDA

View Full Version : QTextEdit print segmentation fault



carre
9th November 2016, 18:32
Hi,

if i select in the print dialog the "MS XPS Document Writer" for printing (WIN 7), a file dialog will be opened. If this dialog will be canceled (by user) -> segementation fault (in line 4) - qt bug - or can i check something more? When a file name will be entered -> no problem.



QPrinter printer;
QPrintDialog *dlg = new QPrintDialog(&printer, this);
if (dlg->exec() == QDialog::Accepted) {
ui->q_text_edit->print(&printer);
}
delete dlg;


Thanks.

anda_skoa
9th November 2016, 19:05
How can line 4 be reached if the dialog has been cancelled?

Cheers,
_

carre
10th November 2016, 10:07
Hi,

Line 4 is reached when the Print Button in the Print Dialog is pressed (maybe to early)

Current sequence:
(for information: "MS XPS Document Writer" is writting the print in a file)

1. in the Qt Application press Button "Print"
2. MS Print Dialog is opened (Application is waiting on Line 3)
3. in the MS Print Dialog press Button "Print" (Application go to 4 and wait) and a File Dialog is opend from MS
4. in this File Dialog press cancel -> segmentation fault (if a new file name is entered -> all is fine)

From my point of view Line 3 is to early executed.

Best regards