Open attachment 89463 [details] from bug 71785 with SAL_DISABLE_PRINTERLIST environment variable set to true, eg.: SAL_DISABLE_PRINTERLIST=true ./soffice SC2012SP1_VMM_CTP2.docx Note how the Table of Contents doesn't start on a new page, but as a continuation of page 2. It should start on the next page, and it does without the SAL_DISABLE_PRINTERLIST environment variable set. It was also fine with the environment variable, until the following commit in 24.8, and its backport in 24.2: https://cgit.freedesktop.org/libreoffice/core/commit/?id=e6f75eb50bc5d1ebccda0c0f80a7b353d991106e author Oliver Specht <oliver.specht@cib.de> 2024-01-18 08:48:10 +0100 committer Thorsten Behrens <thorsten.behrens@allotropia.de> 2024-01-19 23:33:03 +0100 tdf#159254 import paper bin/paper source from rtf/docx files
Created attachment 198026 [details] Minimized reproducer
Note that SAL_DISABLE_PRINTERLIST=false is still treated as if it was true. This SHOULD be SAL_DISABLE_PRINTERLIST=1 (or 0 to force the default).
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/61fd72bff241cf3cb0556cee7e414a698c46cd1d tdf#164263 writerfilter: avoid exception when SAL_DISABLE_PRINTERLIST It will be available in 25.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
(In reply to Justin L from comment #2) > Note that SAL_DISABLE_PRINTERLIST=false is still treated as if it was true. So is SAL_DISABLE_PRINTERLIST=0 actually. The only thing that I can see that isn't treated as true is SAL_DISABLE_PRINTERLIST= with nothing after the equal sign.
The situation is rather interesting, with the interesting code being in vcl/source/gdi/print.cxx. When the printer-list is not disabled (so the normal situation), ApplyPaperSource(to bin 0) ALWAYS exceptions (in a controlled way) because GetPaperBinBySourceIndex always returns -1 (at least for Linux's vcl/unx/generic/print/genprnpsp.cxx). Thus the value never changes (i.e. it stays at the special value of -1), which SwXStyle::GetStyleProperty always recognizes as [From printer settings] But when printer-list is disabled, ApplyPaperSource(to bin 0) works because GetPaperBinBySourceIndex always returns 0 since IsDisplayPrinter(). And since it isn't the special -1 value any more, GetStyleProperty asks the printer to GetPaperBinName(0), to which IsDisplayPrinter() simply returns an empty string. That empty string that getPropertyValue returns MAY NOT be used to setPropertyValue - that's why we were getting the exception. So probably it is probably best to just avoid setting any properties in unoStyle when IsDisplayPrinter().
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/662b5eaf86b5fc15d67ef4f0cf43fd31630ac77e tdf#164263: avoid exception when SAL_DISABLE_PRINTERLIST #2 It will be available in 25.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Comment 6 includes a revert of comment 3.
Justin Luth committed a patch related to this issue. It has been pushed to "libreoffice-25-2": https://git.libreoffice.org/core/commit/1dc4846e76570ab19c028ac23786e4ffd8fc4679 tdf#164263: avoid exception when SAL_DISABLE_PRINTERLIST #2 It will be available in 25.2.0.0.beta2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.