[Qt-interest] [Qt-Interest] Problem with QPrinter under X11 - maybe qt bug

Zeljko zeljko at holobit.net
Mon Oct 17 09:42:04 CEST 2011


Zeljko wrote:

> Hi,
> I don't know if I'm doing something wrong but:
> qt-x11-4.7.4-2.fc14.i686
> After document is printed in /proc/MYPROCESS/fd/ there are orphan symlinks to
> /tmp/cupsXXXXXXX files.  That's fine with me but after it passes open files
> limit (ulimit -n) , my app cannot open any file anymore since number of files
> in /proc/PROCID/fd > 1024 (ulimit -n is 1024 on my machine).
> Tried to print with other apps and there's no orphaned files (kwrite, soffice
> etc).
> 
> This is example from /proc/MYPROC/fd
> lr-x------ 1 linda linda 64 2011-10-17 08:22 12 -> /tmp/cupsa1fKP1 (deleted)
> 
> 1.QPrinter is created
> 2.Doc is successfully printed
> 3.QPrinter is destroyed
> 
> What I'm doing wrong ? KDE apps eg. kwrite doesn't have such problems, so I'm
> wondering if I'm doing something wrong ... but using simple case from
> http://doc.qt.nokia.com/4.7/printing.html shows that problem.

Yes, it's bug ... definitelly.

void MainWin::Izlaz() {
  /* just for testing .. */
  QPainter painter;  
  QPrinter printer(QPrinter::PrinterResolution); 
  QPrintDialog *dialog = new QPrintDialog(&printer, this);
     dialog->setWindowTitle(tr("Print Document"));  
  if (dialog->exec() == QDialog::Accepted){
    painter.begin(&printer);
    painter.drawText(100, 100, QString("Hello world"));
    painter.end();
    /* Nothing helps ... orphans are in /proc/PROCNUM/fd/24 -> /tmp/cupsXXXXX 
(deleted) */
    /* printer.abort(); */
    /* printer.~QPrinter(); */
  }
}







More information about the Qt-interest-old mailing list