core.git: Branch 'libreoffice-24-2' - sd/qa vcl/source

2024-05-15 Thread Patrick Luby (via logerrit)
 sd/qa/unit/PNGExportTests.cxx  |8 
 vcl/source/filter/igif/gifread.cxx |   36 
 2 files changed, 24 insertions(+), 20 deletions(-)

New commits:
commit 73b552139906e10f004bd56e53684cceed071bd6
Author: Patrick Luby 
AuthorDate: Sun May 12 14:04:30 2024 -0400
Commit: Noel Grandin 
CommitDate: Wed May 15 19:54:38 2024 +0200

tdf#160690 set an opaque alpha mask for non-transparent frames

Due to the switch from transparency to alpha in commit
81994cb2b8b32453a92bcb011830fcb884f22ff3, an empty alpha mask
is treated as a completely transparent bitmap. So revert all
of the previous commits for tdf#157576, tdf#157635, and tdf#157793
and create a completely opaque bitmap instead.

Note: this fix also fixes tdf#157576, tdf#157635, and tdf#157793.

Change-Id: Ic2ccad6ab94e4d43b1b66013f85955d474dc0151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167563
Reviewed-by: Patrick Luby 
Tested-by: Jenkins
(cherry picked from commit 2a9eb581f0edfae8123018006df5cc9de1e1fd45)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167674
Reviewed-by: Noel Grandin 

diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx
index 855c3becfd47..69343b8b208d 100644
--- a/sd/qa/unit/PNGExportTests.cxx
+++ b/sd/qa/unit/PNGExportTests.cxx
@@ -483,21 +483,21 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157793)
 CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
 Bitmap aBMP = aBMPEx.GetBitmap();
 BitmapScopedReadAccess pReadAccess(aBMP);
-int nLightGrayCount = 0;
+int nWhiteCount = 0;
 for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
 {
 for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
 {
 const Color aColor = pReadAccess->GetColor(nY, nX);
-if (aColor == 0xfefefe)
-++nLightGrayCount;
+if (aColor == 0xff)
+++nWhiteCount;
 }
 }
 
 // Without the fix in place, this test would have failed with
 // - Expected greater than: 7800
 // - Actual  : 0
-CPPUNIT_ASSERT_GREATER(7800, nLightGrayCount);
+CPPUNIT_ASSERT_GREATER(7800, nWhiteCount);
 }
 
 CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157635)
diff --git a/vcl/source/filter/igif/gifread.cxx 
b/vcl/source/filter/igif/gifread.cxx
index 8f56edaee77f..95b70568d9c7 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -99,7 +99,7 @@ class GIFReader : public GraphicReader
 sal_uInt8   nGCDisposalMethod;  // 'Disposal Method' (see GIF 
docs)
 sal_uInt8   cTransIndex1;
 sal_uInt8   cNonTransIndex1;
-boolbEnhance;
+sal_uLong   nPaletteSize;
 
 voidReadPaletteEntries( BitmapPalette* pPal, sal_uLong 
nCount );
 voidClearImageExtensions();
@@ -157,7 +157,7 @@ GIFReader::GIFReader( SvStream& rStm )
 , nGCTransparentIndex ( 0 )
 , cTransIndex1 ( 0 )
 , cNonTransIndex1 ( 0 )
-, bEnhance( false )
+, nPaletteSize( 0 )
 {
 maUpperName = "SVIGIF";
 aSrcBuf.resize(256);// Memory buffer for ReadNextBlock
@@ -328,12 +328,7 @@ void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, 
sal_uLong nCount )
 (*pPal)[ 254UL ] = COL_BLACK;
 }
 
-// tdf#157793 limit tdf#157635 fix to only larger palettes
-// I don't know why, but the fix for tdf#157635 causes
-// images with a palette of 16 entries to be inverted.
-// Also, fix tdf#158047 by allowing the tdf#157635 fix for
-// palettes with 64 entries.
-bEnhance = (nCount > 16);
+nPaletteSize = nCount;
 }
 
 bool GIFReader::ReadExtension()
@@ -674,16 +669,25 @@ void GIFReader::CreateNewBitmaps()
 aAlphaMask.Invert(); // convert from transparency to alpha
 aAnimationFrame.maBitmapEx = BitmapEx( aBmp8, aAlphaMask );
 }
-else
+else if( nPaletteSize > 2 )
 {
-// tdf#157576 and tdf#157635 mask out black pixels
+// tdf#160690 set an opaque alpha mask for non-transparent frames
 // Due to the switch from transparency to alpha in commit
-// 81994cb2b8b32453a92bcb011830fcb884f22ff3, mask out black
-// pixels in bitmap.
-if (bEnhance)
-aAnimationFrame.maBitmapEx = BitmapEx( aBmp8, aBmp8 );
-else
-aAnimationFrame.maBitmapEx = BitmapEx( aBmp8 );
+// 81994cb2b8b32453a92bcb011830fcb884f22ff3, an empty alpha mask
+// is treated as a completely transparent bitmap. So revert all
+// of the previous commits for tdf#157576, tdf#157635, and tdf#157793
+// and create a completely opaque bitmap instead.
+// Note: this fix also fixes tdf#157576, tdf#157635, and tdf#157793.
+AlphaMask aAlphaMask(aBmp8.GetSizePixel());
+aAnimationFrame.maBitmapEx = BitmapEx( aBmp8, aAlphaMask );
+}
+else
+{
+  

core.git: sd/qa vcl/source

2024-05-15 Thread Patrick Luby (via logerrit)
 sd/qa/unit/PNGExportTests.cxx  |   12 
 vcl/source/filter/igif/gifread.cxx |   36 
 2 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 2a9eb581f0edfae8123018006df5cc9de1e1fd45
Author: Patrick Luby 
AuthorDate: Sun May 12 14:04:30 2024 -0400
Commit: Patrick Luby 
CommitDate: Wed May 15 18:04:35 2024 +0200

tdf#160690 set an opaque alpha mask for non-transparent frames

Due to the switch from transparency to alpha in commit
81994cb2b8b32453a92bcb011830fcb884f22ff3, an empty alpha mask
is treated as a completely transparent bitmap. So revert all
of the previous commits for tdf#157576, tdf#157635, and tdf#157793
and create a completely opaque bitmap instead.

Note: this fix also fixes tdf#157576, tdf#157635, and tdf#157793.

Change-Id: Ic2ccad6ab94e4d43b1b66013f85955d474dc0151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167563
Reviewed-by: Patrick Luby 
Tested-by: Jenkins

diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx
index 8c28a1951f7c..d99955a923ae 100644
--- a/sd/qa/unit/PNGExportTests.cxx
+++ b/sd/qa/unit/PNGExportTests.cxx
@@ -536,25 +536,21 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157793)
 CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
 Bitmap aBMP = aBMPEx.GetBitmap();
 BitmapScopedReadAccess pReadAccess(aBMP);
-int nLightGrayCount = 0;
+int nWhiteCount = 0;
 for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
 {
 for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
 {
 const Color aColor = pReadAccess->GetColor(nY, nX);
-if (aColor == 0xfefefe)
-++nLightGrayCount;
+if (aColor == 0xff)
+++nWhiteCount;
 }
 }
 
-// FIXME this still has some issues with skia
-if (SkiaHelper::isVCLSkiaEnabled())
-return;
-
 // Without the fix in place, this test would have failed with
 // - Expected greater than: 7800
 // - Actual  : 0
-CPPUNIT_ASSERT_GREATER(7800, nLightGrayCount);
+CPPUNIT_ASSERT_GREATER(7800, nWhiteCount);
 }
 
 CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157635)
diff --git a/vcl/source/filter/igif/gifread.cxx 
b/vcl/source/filter/igif/gifread.cxx
index c3151f3274d0..443eb05c045a 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -97,7 +97,7 @@ class GIFReader : public GraphicReader
 sal_uInt8   nGCDisposalMethod;  // 'Disposal Method' (see GIF 
docs)
 sal_uInt8   cTransIndex1;
 sal_uInt8   cNonTransIndex1;
-boolbEnhance;
+sal_uLong   nPaletteSize;
 
 voidReadPaletteEntries( BitmapPalette* pPal, sal_uLong 
nCount );
 voidClearImageExtensions();
@@ -155,7 +155,7 @@ GIFReader::GIFReader( SvStream& rStm )
 , nGCTransparentIndex ( 0 )
 , cTransIndex1 ( 0 )
 , cNonTransIndex1 ( 0 )
-, bEnhance( false )
+, nPaletteSize( 0 )
 {
 maUpperName = "SVIGIF";
 aSrcBuf.resize(256);// Memory buffer for ReadNextBlock
@@ -330,12 +330,7 @@ void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, 
sal_uLong nCount )
 (*pPal)[ 254UL ] = COL_BLACK;
 }
 
-// tdf#157793 limit tdf#157635 fix to only larger palettes
-// I don't know why, but the fix for tdf#157635 causes
-// images with a palette of 16 entries to be inverted.
-// Also, fix tdf#158047 by allowing the tdf#157635 fix for
-// palettes with 64 entries.
-bEnhance = (nCount > 16);
+nPaletteSize = nCount;
 }
 
 bool GIFReader::ReadExtension()
@@ -677,16 +672,25 @@ void GIFReader::CreateNewBitmaps()
 // aBmp1 is already inverted
 aAnimationFrame.maBitmapEx = BitmapEx( aBmp8, aAlphaMask );
 }
-else
+else if( nPaletteSize > 2 )
 {
-// tdf#157576 and tdf#157635 mask out black pixels
+// tdf#160690 set an opaque alpha mask for non-transparent frames
 // Due to the switch from transparency to alpha in commit
-// 81994cb2b8b32453a92bcb011830fcb884f22ff3, mask out black
-// pixels in bitmap.
-if (bEnhance)
-aAnimationFrame.maBitmapEx = BitmapEx( aBmp8, aBmp8 );
-else
-aAnimationFrame.maBitmapEx = BitmapEx( aBmp8 );
+// 81994cb2b8b32453a92bcb011830fcb884f22ff3, an empty alpha mask
+// is treated as a completely transparent bitmap. So revert all
+// of the previous commits for tdf#157576, tdf#157635, and tdf#157793
+// and create a completely opaque bitmap instead.
+// Note: this fix also fixes tdf#157576, tdf#157635, and tdf#157793.
+AlphaMask aAlphaMask(aBmp8.GetSizePixel());
+aAnimationFrame.maBitmapEx = BitmapEx( aBmp8, aAlphaMask );
+}
+else
+{
+// Don't apply the fix for tdf#160690 as it will cause 1 bit bitmaps
+   

core.git: Branch 'libreoffice-24-2' - vcl/osx

2024-05-13 Thread Patrick Luby (via logerrit)
 vcl/osx/salinst.cxx |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 812c3cf069b068b75d01662c241b52bec2dd2928
Author: Patrick Luby 
AuthorDate: Tue May 7 17:41:10 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue May 14 07:34:24 2024 +0200

tdf#160767 skip fix for tdf#155266 when the event hasn't changed

When scrolling in Writer with automatic spellchecking enabled,
the current event never changes because the fix for tdf#155266
causes Writer to get stuck in a loop. So, if the current event
has not changed since the last pass through this code, skip
the fix for tdf#155266.

Change-Id: I97265a7698756c5fb65b6686f6bb77c1caa08862
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167229
Reviewed-by: Patrick Luby 
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Jenkins

diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index 7f755bb618b3..33101c8d1b11 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -750,7 +750,22 @@ bool AquaSalInstance::AnyInput( VclInputFlags nType )
 // not NSEventTypeScrollWheel.
 NSEvent* pCurrentEvent = [NSApp currentEvent];
 if( pCurrentEvent && [pCurrentEvent type] == NSEventTypeScrollWheel )
-nEventMask &= ~NSEventMaskScrollWheel;
+{
+// tdf#160767 skip fix for tdf#155266 when the event hasn't changed
+// When scrolling in Writer with automatic spellchecking enabled,
+// the current event never changes because the fix for tdf#155266
+// causes Writer to get stuck in a loop. So, if the current event
+// has not changed since the last pass through this code, skip
+// the fix for tdf#155266.
+static NSEvent *pLastCurrentEvent = nil;
+if( pLastCurrentEvent != pCurrentEvent )
+{
+if( pLastCurrentEvent )
+[pLastCurrentEvent release];
+pLastCurrentEvent = [pCurrentEvent retain];
+nEventMask &= ~NSEventMaskScrollWheel;
+}
+}
 }
 
 if( nType & VclInputFlags::KEYBOARD)


core.git: vcl/ios

2024-05-13 Thread Patrick Luby (via logerrit)
 vcl/ios/clipboard.cxx |   77 +-
 vcl/ios/clipboard.hxx |   15 +
 2 files changed, 91 insertions(+), 1 deletion(-)

New commits:
commit 4e5040dc44024f8313ca51627b6871675865cdf6
Author: Patrick Luby 
AuthorDate: Sat Apr 13 19:46:48 2024 -0400
Commit: Caolán McNamara 
CommitDate: Mon May 13 12:05:05 2024 +0200

cool#5839 fire a clipboard changed event in the iOS app

A clipboard changed event needs to be fired whenever the
native general pasteboard changes. Otherwise, if the clipboard
is empty when a document is opened, the Paste and Paste Special
menu items and toolbar buttons will be disabled and will never
be enabled even after something has been copied to the general
pasteboard.

Change-Id: I8a70a2ac4de55593a886233d144dc18c3c57178e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166073
Reviewed-by: Patrick Luby 
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167570
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/ios/clipboard.cxx b/vcl/ios/clipboard.cxx
index 59209504da31..109f744e87c8 100644
--- a/vcl/ios/clipboard.cxx
+++ b/vcl/ios/clipboard.cxx
@@ -29,6 +29,56 @@
 #include 
 #include 
 
+@implementation PasteboardChangedEventListener
+
+- (PasteboardChangedEventListener*)initWithiOSClipboard:(iOSClipboard*)pcb
+{
+self = [super init];
+
+if (self)
+{
+// Just to be safe, set clipboard to a nullptr to ignore any
+// synchronous callbacks that might occur when adding the observer
+piOSClipboard = nullptr;
+
+[[NSNotificationCenter defaultCenter] addObserver:self
+ 
selector:@selector(pasteboardChanged:)
+ 
name:UIPasteboardChangedNotification
+   object:[UIPasteboard 
generalPasteboard]];
+
+// According to following, no UIPasteboardChangedNotification
+// notifications are received when an app is not active. So, post the
+// notification so that the LibreOffice vcl/ios code can handle any
+// clipboard changes:
+//   
https://stackoverflow.com/questions/4240087/receiving-uipasteboard-generalpasteboard-notification-while-in-the-background
+// Note: UIApplicationDidBecomeActiveNotification is never sent when
+// running in Mac Catalyst so listen for UISceneDidActivateNotification
+// instead.
+[[NSNotificationCenter defaultCenter] addObserver:self
+ 
selector:@selector(pasteboardChanged:)
+ 
name:UISceneDidActivateNotification
+   object:nil];
+
+piOSClipboard = pcb;
+}
+
+return self;
+}
+
+- (void)pasteboardChanged:(NSNotification*)aNotification
+{
+if (piOSClipboard)
+piOSClipboard->contentsChanged();
+}
+
+- (void)disposing
+{
+piOSClipboard = nullptr;
+[[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+@end
+
 iOSClipboard::iOSClipboard()
 : WeakComponentImplHelper(m_aMutex)
 {
@@ -37,9 +87,17 @@ iOSClipboard::iOSClipboard()
 mrXMimeCntFactory = 
css::datatransfer::MimeContentTypeFactory::create(xContext);
 
 mpDataFlavorMapper.reset(new DataFlavorMapper());
+
+mnPasteboardChangeCount = 0;
+mpPasteboardChangedEventListener =
+[[PasteboardChangedEventListener alloc] initWithiOSClipboard:this];
 }
 
-iOSClipboard::~iOSClipboard() {}
+iOSClipboard::~iOSClipboard()
+{
+[mpPasteboardChangedEventListener disposing];
+[mpPasteboardChangedEventListener release];
+}
 
 css::uno::Reference SAL_CALL 
iOSClipboard::getContents()
 {
@@ -173,6 +231,23 @@ css::uno::Sequence SAL_CALL 
iOSClipboard::getSupportedServiceNames()
 return { OUString("com.sun.star.datatransfer.clipboard.SystemClipboard") };
 }
 
+void iOSClipboard::contentsChanged()
+{
+NSInteger nPasteboardChangeCount = [[UIPasteboard generalPasteboard] 
changeCount];
+if (mnPasteboardChangeCount != nPasteboardChangeCount)
+{
+// cool#5839 fire a clipboard changed event in the iOS app
+// A clipboard changed event needs to be fired whenever the
+// native general pasteboard changes. Otherwise, if the clipboard
+// is empty when a document is opened, the Paste and Paste Special
+// menu items and toolbar buttons will be disabled and will never
+// be enabled even after something has been copied to the general
+// pasteboard.
+mnPasteboardChangeCount = nPasteboardChangeCount;
+fireClipboardChangedEvent(getContents());
+}
+}
+
 css::uno::Reference
 IosSalInstance::CreateClipboard(const css::uno::Sequence&)
 {
diff --git a/vcl/ios/clipboard.hxx 

core.git: vcl/osx

2024-05-07 Thread Patrick Luby (via logerrit)
 vcl/osx/salinst.cxx |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 92815f3a464b447898ecf52492247335228e4a72
Author: Patrick Luby 
AuthorDate: Tue May 7 17:41:10 2024 -0400
Commit: Patrick Luby 
CommitDate: Wed May 8 01:39:44 2024 +0200

tdf#160767 skip fix for tdf#155266 when the event hasn't changed

When scrolling in Writer with automatic spellchecking enabled,
the current event never changes because the fix for tdf#155266
causes Writer to get stuck in a loop. So, if the current event
has not changed since the last pass through this code, skip
the fix for tdf#155266.

Change-Id: I97265a7698756c5fb65b6686f6bb77c1caa08862
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167298
Reviewed-by: Patrick Luby 
Tested-by: Jenkins

diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index db2b2c605677..e8543fcda19c 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -750,7 +750,22 @@ bool AquaSalInstance::AnyInput( VclInputFlags nType )
 // not NSEventTypeScrollWheel.
 NSEvent* pCurrentEvent = [NSApp currentEvent];
 if( pCurrentEvent && [pCurrentEvent type] == NSEventTypeScrollWheel )
-nEventMask &= ~NSEventMaskScrollWheel;
+{
+// tdf#160767 skip fix for tdf#155266 when the event hasn't changed
+// When scrolling in Writer with automatic spellchecking enabled,
+// the current event never changes because the fix for tdf#155266
+// causes Writer to get stuck in a loop. So, if the current event
+// has not changed since the last pass through this code, skip
+// the fix for tdf#155266.
+static NSEvent *pLastCurrentEvent = nil;
+if( pLastCurrentEvent != pCurrentEvent )
+{
+if( pLastCurrentEvent )
+[pLastCurrentEvent release];
+pLastCurrentEvent = [pCurrentEvent retain];
+nEventMask &= ~NSEventMaskScrollWheel;
+}
+}
 }
 
 if( nType & VclInputFlags::KEYBOARD)


core.git: Branch 'libreoffice-7-6-7' - sc/source

2024-05-07 Thread Patrick Luby (via logerrit)
 sc/source/ui/app/transobj.cxx |   31 +--
 1 file changed, 29 insertions(+), 2 deletions(-)

New commits:
commit bae8980495d54d235b71938bc313be22d7455585
Author: Patrick Luby 
AuthorDate: Sat May 4 19:58:03 2024 -0400
Commit: Christian Lohmaier 
CommitDate: Tue May 7 18:14:44 2024 +0200

tdf#160855 fix crash due to Skia's internal maximum pixel limit

Somewhere in the tens of thousands of selected fill cells,
the size of the VirtualDevice exceeds 1 GB of pixels. But
Skia, at least on macOS, will fail to create a surface.
Even if there is ample free memory, Skia/Raster will fail.

The second problem is that even if you disable Skia, the
crash is just delayed when a BitmapEx is created from the
VirtualDevice and malloc() fails.

Since this data flavor really triggers one or more system
memory limits, lower the resolution of the bitmap by keeping
the VirtualDevice pixel size within an arbitrary number of
pixels.

Note: the artibrary "maximum number of pixels" limit that
that Skia can handle may need to be raised or lowered for
platforms other than macOS.

Change-Id: Ie087f2db152470aa70521fbe5fe6c7cedd8504af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167145
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 8d9f54165d28d83092667b7bfcd0ee48ade54c87)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167217
Tested-by: Christian Lohmaier 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 5f0599c888b3..e5ed3b1afe2a 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -405,11 +405,38 @@ bool ScTransferObj::GetData( const 
datatransfer::DataFlavor& rFlavor, const OUSt
  aReducedBlock.aEnd.Col(), 
aReducedBlock.aEnd.Row(),
  aReducedBlock.aStart.Tab() );
 ScopedVclPtrInstance< VirtualDevice > pVirtDev;
-
pVirtDev->SetOutputSizePixel(pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM)));
+
+// tdf#160855 fix crash due to Skia's internal maximum pixel limit
+// Somewhere in the tens of thousands of selected fill cells,
+// the size of the VirtualDevice exceeds 1 GB of pixels. But
+// Skia, at least on macOS, will fail to create a surface.
+// Even if there is ample free memory, Skia/Raster will fail.
+// The second problem is that even if you disable Skia, the
+// crash is just delayed when a BitmapEx is created from the
+// VirtualDevice and malloc() fails.
+// Since this data flavor really triggers one or more system
+// memory limits, lower the resolution of the bitmap by keeping
+// the VirtualDevice pixel size within an arbitrary number of
+// pixels.
+// Note: the artibrary "maximum number of pixels" limit that
+// that Skia can handle may need to be raised or lowered for
+// platforms other than macOS.
+static constexpr tools::Long nCopyToImageMaxPixels = 8192 * 8192;
+Fraction aScale(1.0);
+Size aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM));
+tools::Long nPixels(aPixelSize.Width() * aPixelSize.Height());
+if (nPixels < 0 || nPixels > nCopyToImageMaxPixels)
+{
+aScale = Fraction(nCopyToImageMaxPixels, nPixels);
+aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM, Point(), aScale, aScale));
+nPixels = aPixelSize.Width() * aPixelSize.Height();
+}
+
+pVirtDev->SetOutputSizePixel(aPixelSize);
 
 PaintToDev( pVirtDev, *m_pDoc, 1.0, aReducedBlock );
 
-pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel ) );
+pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel, Point(), aScale, 
aScale ) );
 BitmapEx aBmp = pVirtDev->GetBitmapEx( Point(), 
pVirtDev->GetOutputSize() );
 bOK = SetBitmapEx( aBmp, rFlavor );
 }


core.git: Branch 'libreoffice-7-6' - sc/source

2024-05-07 Thread Patrick Luby (via logerrit)
 sc/source/ui/app/transobj.cxx |   31 +--
 1 file changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 6011796f8d4a1ec81912713f21ec8df5d03769e9
Author: Patrick Luby 
AuthorDate: Sat May 4 19:58:03 2024 -0400
Commit: Noel Grandin 
CommitDate: Tue May 7 08:47:09 2024 +0200

tdf#160855 fix crash due to Skia's internal maximum pixel limit

Somewhere in the tens of thousands of selected fill cells,
the size of the VirtualDevice exceeds 1 GB of pixels. But
Skia, at least on macOS, will fail to create a surface.
Even if there is ample free memory, Skia/Raster will fail.

The second problem is that even if you disable Skia, the
crash is just delayed when a BitmapEx is created from the
VirtualDevice and malloc() fails.

Since this data flavor really triggers one or more system
memory limits, lower the resolution of the bitmap by keeping
the VirtualDevice pixel size within an arbitrary number of
pixels.

Note: the artibrary "maximum number of pixels" limit that
that Skia can handle may need to be raised or lowered for
platforms other than macOS.

Change-Id: Ie087f2db152470aa70521fbe5fe6c7cedd8504af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167145
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 8d9f54165d28d83092667b7bfcd0ee48ade54c87)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167216

diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 5f0599c888b3..e5ed3b1afe2a 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -405,11 +405,38 @@ bool ScTransferObj::GetData( const 
datatransfer::DataFlavor& rFlavor, const OUSt
  aReducedBlock.aEnd.Col(), 
aReducedBlock.aEnd.Row(),
  aReducedBlock.aStart.Tab() );
 ScopedVclPtrInstance< VirtualDevice > pVirtDev;
-
pVirtDev->SetOutputSizePixel(pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM)));
+
+// tdf#160855 fix crash due to Skia's internal maximum pixel limit
+// Somewhere in the tens of thousands of selected fill cells,
+// the size of the VirtualDevice exceeds 1 GB of pixels. But
+// Skia, at least on macOS, will fail to create a surface.
+// Even if there is ample free memory, Skia/Raster will fail.
+// The second problem is that even if you disable Skia, the
+// crash is just delayed when a BitmapEx is created from the
+// VirtualDevice and malloc() fails.
+// Since this data flavor really triggers one or more system
+// memory limits, lower the resolution of the bitmap by keeping
+// the VirtualDevice pixel size within an arbitrary number of
+// pixels.
+// Note: the artibrary "maximum number of pixels" limit that
+// that Skia can handle may need to be raised or lowered for
+// platforms other than macOS.
+static constexpr tools::Long nCopyToImageMaxPixels = 8192 * 8192;
+Fraction aScale(1.0);
+Size aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM));
+tools::Long nPixels(aPixelSize.Width() * aPixelSize.Height());
+if (nPixels < 0 || nPixels > nCopyToImageMaxPixels)
+{
+aScale = Fraction(nCopyToImageMaxPixels, nPixels);
+aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM, Point(), aScale, aScale));
+nPixels = aPixelSize.Width() * aPixelSize.Height();
+}
+
+pVirtDev->SetOutputSizePixel(aPixelSize);
 
 PaintToDev( pVirtDev, *m_pDoc, 1.0, aReducedBlock );
 
-pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel ) );
+pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel, Point(), aScale, 
aScale ) );
 BitmapEx aBmp = pVirtDev->GetBitmapEx( Point(), 
pVirtDev->GetOutputSize() );
 bOK = SetBitmapEx( aBmp, rFlavor );
 }


core.git: Branch 'libreoffice-24-2' - sc/source

2024-05-07 Thread Patrick Luby (via logerrit)
 sc/source/ui/app/transobj.cxx |   31 +--
 1 file changed, 29 insertions(+), 2 deletions(-)

New commits:
commit b11c9b5f205907390ef210ae3c1f9f54fee84820
Author: Patrick Luby 
AuthorDate: Sat May 4 19:58:03 2024 -0400
Commit: Noel Grandin 
CommitDate: Tue May 7 08:47:20 2024 +0200

tdf#160855 fix crash due to Skia's internal maximum pixel limit

Somewhere in the tens of thousands of selected fill cells,
the size of the VirtualDevice exceeds 1 GB of pixels. But
Skia, at least on macOS, will fail to create a surface.
Even if there is ample free memory, Skia/Raster will fail.

The second problem is that even if you disable Skia, the
crash is just delayed when a BitmapEx is created from the
VirtualDevice and malloc() fails.

Since this data flavor really triggers one or more system
memory limits, lower the resolution of the bitmap by keeping
the VirtualDevice pixel size within an arbitrary number of
pixels.

Note: the artibrary "maximum number of pixels" limit that
that Skia can handle may need to be raised or lowered for
platforms other than macOS.

Change-Id: Ie087f2db152470aa70521fbe5fe6c7cedd8504af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167145
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 8d9f54165d28d83092667b7bfcd0ee48ade54c87)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167215

diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 5f0599c888b3..e5ed3b1afe2a 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -405,11 +405,38 @@ bool ScTransferObj::GetData( const 
datatransfer::DataFlavor& rFlavor, const OUSt
  aReducedBlock.aEnd.Col(), 
aReducedBlock.aEnd.Row(),
  aReducedBlock.aStart.Tab() );
 ScopedVclPtrInstance< VirtualDevice > pVirtDev;
-
pVirtDev->SetOutputSizePixel(pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM)));
+
+// tdf#160855 fix crash due to Skia's internal maximum pixel limit
+// Somewhere in the tens of thousands of selected fill cells,
+// the size of the VirtualDevice exceeds 1 GB of pixels. But
+// Skia, at least on macOS, will fail to create a surface.
+// Even if there is ample free memory, Skia/Raster will fail.
+// The second problem is that even if you disable Skia, the
+// crash is just delayed when a BitmapEx is created from the
+// VirtualDevice and malloc() fails.
+// Since this data flavor really triggers one or more system
+// memory limits, lower the resolution of the bitmap by keeping
+// the VirtualDevice pixel size within an arbitrary number of
+// pixels.
+// Note: the artibrary "maximum number of pixels" limit that
+// that Skia can handle may need to be raised or lowered for
+// platforms other than macOS.
+static constexpr tools::Long nCopyToImageMaxPixels = 8192 * 8192;
+Fraction aScale(1.0);
+Size aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM));
+tools::Long nPixels(aPixelSize.Width() * aPixelSize.Height());
+if (nPixels < 0 || nPixels > nCopyToImageMaxPixels)
+{
+aScale = Fraction(nCopyToImageMaxPixels, nPixels);
+aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM, Point(), aScale, aScale));
+nPixels = aPixelSize.Width() * aPixelSize.Height();
+}
+
+pVirtDev->SetOutputSizePixel(aPixelSize);
 
 PaintToDev( pVirtDev, *m_pDoc, 1.0, aReducedBlock );
 
-pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel ) );
+pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel, Point(), aScale, 
aScale ) );
 BitmapEx aBmp = pVirtDev->GetBitmapEx( Point(), 
pVirtDev->GetOutputSize() );
 bOK = SetBitmapEx( aBmp, rFlavor );
 }


core.git: sc/source

2024-05-06 Thread Patrick Luby (via logerrit)
 sc/source/ui/app/transobj.cxx |   31 +--
 1 file changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 8d9f54165d28d83092667b7bfcd0ee48ade54c87
Author: Patrick Luby 
AuthorDate: Sat May 4 19:58:03 2024 -0400
Commit: Patrick Luby 
CommitDate: Mon May 6 19:15:21 2024 +0200

tdf#160855 fix crash due to Skia's internal maximum pixel limit

Somewhere in the tens of thousands of selected fill cells,
the size of the VirtualDevice exceeds 1 GB of pixels. But
Skia, at least on macOS, will fail to create a surface.
Even if there is ample free memory, Skia/Raster will fail.

The second problem is that even if you disable Skia, the
crash is just delayed when a BitmapEx is created from the
VirtualDevice and malloc() fails.

Since this data flavor really triggers one or more system
memory limits, lower the resolution of the bitmap by keeping
the VirtualDevice pixel size within an arbitrary number of
pixels.

Note: the artibrary "maximum number of pixels" limit that
that Skia can handle may need to be raised or lowered for
platforms other than macOS.

Change-Id: Ie087f2db152470aa70521fbe5fe6c7cedd8504af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167145
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index b42154945e89..f242abc497b0 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -405,11 +405,38 @@ bool ScTransferObj::GetData( const 
datatransfer::DataFlavor& rFlavor, const OUSt
  aReducedBlock.aEnd.Col(), 
aReducedBlock.aEnd.Row(),
  aReducedBlock.aStart.Tab() );
 ScopedVclPtrInstance< VirtualDevice > pVirtDev;
-
pVirtDev->SetOutputSizePixel(pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM)));
+
+// tdf#160855 fix crash due to Skia's internal maximum pixel limit
+// Somewhere in the tens of thousands of selected fill cells,
+// the size of the VirtualDevice exceeds 1 GB of pixels. But
+// Skia, at least on macOS, will fail to create a surface.
+// Even if there is ample free memory, Skia/Raster will fail.
+// The second problem is that even if you disable Skia, the
+// crash is just delayed when a BitmapEx is created from the
+// VirtualDevice and malloc() fails.
+// Since this data flavor really triggers one or more system
+// memory limits, lower the resolution of the bitmap by keeping
+// the VirtualDevice pixel size within an arbitrary number of
+// pixels.
+// Note: the artibrary "maximum number of pixels" limit that
+// that Skia can handle may need to be raised or lowered for
+// platforms other than macOS.
+static constexpr tools::Long nCopyToImageMaxPixels = 8192 * 8192;
+Fraction aScale(1.0);
+Size aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM));
+tools::Long nPixels(aPixelSize.Width() * aPixelSize.Height());
+if (nPixels < 0 || nPixels > nCopyToImageMaxPixels)
+{
+aScale = Fraction(nCopyToImageMaxPixels, nPixels);
+aPixelSize = pVirtDev->LogicToPixel(aMMRect.GetSize(), 
MapMode(MapUnit::Map100thMM, Point(), aScale, aScale));
+nPixels = aPixelSize.Width() * aPixelSize.Height();
+}
+
+pVirtDev->SetOutputSizePixel(aPixelSize);
 
 PaintToDev( pVirtDev, *m_pDoc, 1.0, aReducedBlock );
 
-pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel ) );
+pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel, Point(), aScale, 
aScale ) );
 BitmapEx aBmp = pVirtDev->GetBitmapEx( Point(), 
pVirtDev->GetOutputSize() );
 bOK = SetBitmapEx( aBmp, rFlavor );
 }


core.git: Branch 'libreoffice-7-6-7' - vcl/skia

2024-05-06 Thread Patrick Luby (via logerrit)
 vcl/skia/gdiimpl.cxx |   20 
 1 file changed, 20 insertions(+)

New commits:
commit 01fa786b27ac08aff7eb896653103b36bae6bbfe
Author: Patrick Luby 
AuthorDate: Fri Apr 26 21:29:10 2024 -0400
Commit: Patrick Luby 
CommitDate: Mon May 6 19:14:58 2024 +0200

tdf#153306 prevent subpixel shifting of X coordinate

HACK: for some unknown reason, if the X coordinate of the
path's bounds is more than 1024, SkBlendMode::kExclusion will
shift by about a half a pixel to the right with Skia/Metal on
a Retina display. Weirdly, if the same polygon is repeatedly
drawn, the total shift is cumulative so if the drawn polygon
is more than a few pixels wide, the blinking cursor in Writer
will exhibit this bug but only for one thin vertical slice at
a time. Apparently, shifting drawing a very tiny amount to
the left seems to be enough to quell this runaway cumulative
X coordinate shift.

Change-Id: Iabe9078e416b0dde003ee61c88817ff970cc8d39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166721
Tested-by: Patrick Luby 
Reviewed-by: Michael Stahl 
Reviewed-by: Patrick Luby 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index a6e030924ab6..eb6faeaa99d2 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1489,6 +1489,26 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon 
const& rPoly, SalInvert eFl
 aPaint.setShader(
 aBitmap.makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat, 
SkSamplingOptions()));
 }
+
+#ifdef SK_METAL
+// tdf#153306 prevent subpixel shifting of X coordinate
+// HACK: for some unknown reason, if the X coordinate of the
+// path's bounds is more than 1024, SkBlendMode::kExclusion will
+// shift by about a half a pixel to the right with Skia/Metal on
+// a Retina display. Weirdly, if the same polygon is repeatedly
+// drawn, the total shift is cumulative so if the drawn polygon
+// is more than a few pixels wide, the blinking cursor in Writer
+// will exhibit this bug but only for one thin vertical slice at
+// a time. Apparently, shifting drawing a very tiny amount to
+// the left seems to be enough to quell this runaway cumulative
+// X coordinate shift.
+if (isGPU())
+{
+SkMatrix aMatrix;
+aMatrix.set(SkMatrix::kMTransX, -0.25);
+getDrawCanvas()->concat(aMatrix);
+}
+#endif
 }
 getDrawCanvas()->drawPath(aPath, aPaint);
 postDraw();


core.git: Branch 'libreoffice-7-6' - vcl/skia

2024-05-03 Thread Patrick Luby (via logerrit)
 vcl/skia/gdiimpl.cxx |   20 
 1 file changed, 20 insertions(+)

New commits:
commit 9fc1e9e0d438a0a36e1e93826312170c9c2dac2a
Author: Patrick Luby 
AuthorDate: Fri Apr 26 21:29:10 2024 -0400
Commit: Michael Stahl 
CommitDate: Fri May 3 11:51:37 2024 +0200

tdf#153306 prevent subpixel shifting of X coordinate

HACK: for some unknown reason, if the X coordinate of the
path's bounds is more than 1024, SkBlendMode::kExclusion will
shift by about a half a pixel to the right with Skia/Metal on
a Retina display. Weirdly, if the same polygon is repeatedly
drawn, the total shift is cumulative so if the drawn polygon
is more than a few pixels wide, the blinking cursor in Writer
will exhibit this bug but only for one thin vertical slice at
a time. Apparently, shifting drawing a very tiny amount to
the left seems to be enough to quell this runaway cumulative
X coordinate shift.

Change-Id: Iabe9078e416b0dde003ee61c88817ff970cc8d39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166768
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
Reviewed-by: Michael Stahl 

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index a6e030924ab6..eb6faeaa99d2 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1489,6 +1489,26 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon 
const& rPoly, SalInvert eFl
 aPaint.setShader(
 aBitmap.makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat, 
SkSamplingOptions()));
 }
+
+#ifdef SK_METAL
+// tdf#153306 prevent subpixel shifting of X coordinate
+// HACK: for some unknown reason, if the X coordinate of the
+// path's bounds is more than 1024, SkBlendMode::kExclusion will
+// shift by about a half a pixel to the right with Skia/Metal on
+// a Retina display. Weirdly, if the same polygon is repeatedly
+// drawn, the total shift is cumulative so if the drawn polygon
+// is more than a few pixels wide, the blinking cursor in Writer
+// will exhibit this bug but only for one thin vertical slice at
+// a time. Apparently, shifting drawing a very tiny amount to
+// the left seems to be enough to quell this runaway cumulative
+// X coordinate shift.
+if (isGPU())
+{
+SkMatrix aMatrix;
+aMatrix.set(SkMatrix::kMTransX, -0.25);
+getDrawCanvas()->concat(aMatrix);
+}
+#endif
 }
 getDrawCanvas()->drawPath(aPath, aPaint);
 postDraw();


core.git: Branch 'libreoffice-7-6-7' - vcl/qa vcl/source

2024-04-30 Thread Patrick Luby (via logerrit)
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |6 +-
 vcl/source/gdi/pdfwriter_impl.cxx  |   14 ++
 2 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit 8dc932a517818b5b721653b372aa0124aff2375f
Author: Patrick Luby 
AuthorDate: Mon Apr 22 19:36:14 2024 -0400
Commit: Patrick Luby 
CommitDate: Tue Apr 30 15:12:28 2024 +0200

tdf#160714 use crop box for bounds of embedded PDF object

If there is no crop box, fallback to the media box just to be safe.

Change-Id: I29f99a43e550cf09a1534c0aa01ffd6a55536fb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166544
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 4b31f87e918c38a7eb30ceb85563a5c98b426da5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166673
Reviewed-by: Michael Stahl 
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Patrick Luby 

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index d6ae5f527ab8..483910dcf07f 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -45,6 +45,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -7800,7 +7801,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, 
testRexportMediaBoxOrigin)
 = { // Rotation by $   heta$ $cos( heta), sin( heta), -sin(
heta), cos( heta)$
 0, -1, 1, 0,
 // Translate x,y
--aOrigin[1] - aSize[1] / 2 + aSize[0] / 2, aOrigin[0] + aSize[0] / 
2 + aSize[1] / 2
+-aOrigin[1] - aSize[1] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
++ aSize[0] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2,
+aOrigin[0] + aSize[0] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
++ aSize[1] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
   };
 
 for (sal_Int32 nIdx = 0; nIdx < 6; ++nIdx)
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index d3cb95ea7d0a..d104ca9ea1df 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9106,9 +9106,15 @@ void PDFWriterImpl::writeReferenceXObject(const 
ReferenceXObjectEmit& rEmit)
 }
 
 double aOrigin[2] = { 0.0, 0.0 };
-if (auto* pArray = 
dynamic_cast(pPage->Lookup("MediaBox")))
+
+// tdf#160714 use crop box for bounds of embedded PDF object
+// If there is no crop box, fallback to the media box just to be safe.
+auto* pBoundsArray = 
dynamic_cast(pPage->Lookup("CropBox"));
+if (!pBoundsArray)
+pBoundsArray = 
dynamic_cast(pPage->Lookup("MediaBox"));
+if (pBoundsArray)
 {
-const auto& rElements = pArray->GetElements();
+const auto& rElements = pBoundsArray->GetElements();
 if (rElements.size() >= 4)
 {
 // get x1, y1 of the rectangle.
@@ -9221,9 +9227,9 @@ void PDFWriterImpl::writeReferenceXObject(const 
ReferenceXObjectEmit& rEmit)
 // Now transform the object: rotate around the center and make 
sure that the rotation
 // doesn't affect the aspect ratio.
 basegfx::B2DHomMatrix aMat;
-aMat.translate(-0.5 * aBBox.getWidth() - aOrigin[0], -0.5 * 
aBBox.getHeight() - aOrigin[1]);
+aMat.translate((-0.5 * aBBox.getWidth() / fMagicScaleFactor) - 
aOrigin[0], (-0.5 * aBBox.getHeight() / fMagicScaleFactor) - aOrigin[1]);
 aMat.rotate(basegfx::deg2rad(nAngle));
-aMat.translate(0.5 * nWidth, 0.5 * nHeight);
+aMat.translate(0.5 * nWidth / fMagicScaleFactor, 0.5 * nHeight / 
fMagicScaleFactor);
 
 aLine.append(" /Matrix [ ");
 aLine.append(aMat.a());


core.git: vcl/inc vcl/osx vcl/quartz vcl/source

2024-04-29 Thread Patrick Luby (via logerrit)
 vcl/inc/quartz/salgdi.h  |4 
 vcl/osx/salframe.cxx |2 +-
 vcl/quartz/salgdi.cxx|   13 +
 vcl/source/app/IconThemeSelector.cxx |4 ++--
 vcl/source/image/ImplImage.cxx   |9 -
 5 files changed, 28 insertions(+), 4 deletions(-)

New commits:
commit f4ef5435df5560e6b6b061ce4053c71e2819bf51
Author: Patrick Luby 
AuthorDate: Mon Apr 29 09:35:30 2024 -0400
Commit: Patrick Luby 
CommitDate: Tue Apr 30 01:24:29 2024 +0200

tdf#130678 draw SVG icons at Retina resolution on macOS

Also, change the default icon theme on macOS to SVG now that SVG icons
support Retina display resolution and the existing PNG icon themes do not.

Change-Id: I8c86c316b0db005661759c132ecf7e8667cf30bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166867
Reviewed-by: Patrick Luby 
Tested-by: Jenkins

diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index c8befcc50280..b7fb674f7553 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -473,6 +473,10 @@ public:
 GetTextLayout(int nFallbackLevel) override;
 virtual voidDrawTextLayout( const GenericSalLayout& ) override;
 
+#ifdef MACOSX
+virtual boolShouldDownscaleIconsAtSurface(double* pScaleOut) 
const override;
+#endif
+
 virtual SystemGraphicsData
 GetGraphicsData() const override;
 };
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index b02dbc59585e..940337b770a1 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1390,7 +1390,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 StyleSettings aStyleSettings = rSettings.GetStyleSettings();
 
 bool bUseDarkMode(GetUseDarkMode());
-OUString sThemeName(!bUseDarkMode ? u"sukapura" : u"sukapura_dark");
+OUString sThemeName(!bUseDarkMode ? u"sukapura_svg" : 
u"sukapura_dark_svg");
 aStyleSettings.SetPreferredIconTheme(sThemeName, bUseDarkMode);
 
 Color aControlBackgroundColor(getNSBoxBackgroundColor([NSColor 
controlBackgroundColor]));
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index fd81f1a04512..8c9d3a6486dd 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -299,6 +299,19 @@ void AquaSalGraphics::DrawTextLayout(const 
GenericSalLayout& rLayout)
 mpBackend->drawTextLayout(rLayout);
 }
 
+#ifdef MACOSX
+
+bool AquaSalGraphics::ShouldDownscaleIconsAtSurface(double* pScaleOut) const
+{
+if (comphelper::LibreOfficeKit::isActive())
+return SalGraphics::ShouldDownscaleIconsAtSurface(pScaleOut);
+if (pScaleOut)
+*pScaleOut = sal::aqua::getWindowScaling();
+return true;
+}
+
+#endif
+
 void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout)
 {
 #ifdef IOS
diff --git a/vcl/source/app/IconThemeSelector.cxx 
b/vcl/source/app/IconThemeSelector.cxx
index eb79752beb47..ae3af74b3da2 100644
--- a/vcl/source/app/IconThemeSelector.cxx
+++ b/vcl/source/app/IconThemeSelector.cxx
@@ -79,9 +79,9 @@ IconThemeSelector::GetIconThemeForDesktopEnvironment(const 
OUString& desktopEnvi
 }
 else if ( desktopEnvironment.equalsIgnoreAsciiCase("macosx") ) {
 if (!bPreferDarkIconTheme)
-r = "sukapura";
+r = "sukapura_svg";
 else
-r = "sukapura_dark";
+r = "sukapura_dark_svg";
 }
 else if ( desktopEnvironment.equalsIgnoreAsciiCase("gnome") ||
  desktopEnvironment.equalsIgnoreAsciiCase("mate") ||
diff --git a/vcl/source/image/ImplImage.cxx b/vcl/source/image/ImplImage.cxx
index cf70052a9fd7..f4b1cbba21a4 100644
--- a/vcl/source/image/ImplImage.cxx
+++ b/vcl/source/image/ImplImage.cxx
@@ -61,13 +61,20 @@ bool ImplImage::loadStockAtScale(SalGraphics* pGraphics, 
BitmapEx )
 sal_Int32 nScalePercentage = -1;
 
 double fScale(1.0);
+OUString aIconTheme = 
Application::GetSettings().GetStyleSettings().DetermineIconTheme();
+#ifdef MACOSX
+if (aIconTheme.endsWith("_svg"))
+{
+#endif
 if (pGraphics && pGraphics->ShouldDownscaleIconsAtSurface()) // 
scale at the surface
 {
 nScalePercentage = fScale * 100.0;
 eScalingFlags = ImageLoadFlags::IgnoreScalingFactor;
 }
+#ifdef MACOSX
+}
+#endif
 
-OUString aIconTheme = 
Application::GetSettings().GetStyleSettings().DetermineIconTheme();
 if (!ImageTree::get().loadImage(maStockName, aIconTheme, aBitmapEx, true,
 nScalePercentage, eScalingFlags))
 {


core.git: Branch 'libreoffice-24-2-3' - vcl/skia

2024-04-29 Thread Patrick Luby (via logerrit)
 vcl/skia/gdiimpl.cxx |   20 
 1 file changed, 20 insertions(+)

New commits:
commit 77c26dae7c984f5c60206091f87897079c8a5d93
Author: Patrick Luby 
AuthorDate: Fri Apr 26 20:25:03 2024 -0400
Commit: Christian Lohmaier 
CommitDate: Mon Apr 29 20:21:50 2024 +0200

tdf#153306 prevent subpixel shifting of X coordinate

HACK: for some unknown reason, if the X coordinate of the
path's bounds is more than 1024, SkBlendMode::kExclusion will
shift by about a half a pixel to the right with Skia/Metal on
a Retina display. Weirdly, if the same polygon is repeatedly
drawn, the total shift is cumulative so if the drawn polygon
is more than a few pixels wide, the blinking cursor in Writer
will exhibit this bug but only for one thin vertical slice at
a time. Apparently, shifting drawing a very tiny amount to
the left seems to be enough to quell this runaway cumulative
X coordinate shift.

Change-Id: Ic1ac8a390df51c4aa1cc3183590dce72059af6b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166766
Reviewed-by: Patrick Luby 
Tested-by: Jenkins
(cherry picked from commit 05d3a99aa687ee4e1706f9403651379b7ebdad89)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166723
Tested-by: Christian Lohmaier 
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index d7028b959842..dce3175febbc 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1490,6 +1490,26 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon 
const& rPoly, SalInvert eFl
 aPaint.setShader(
 aBitmap.makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat, 
SkSamplingOptions()));
 }
+
+#ifdef SK_METAL
+// tdf#153306 prevent subpixel shifting of X coordinate
+// HACK: for some unknown reason, if the X coordinate of the
+// path's bounds is more than 1024, SkBlendMode::kExclusion will
+// shift by about a half a pixel to the right with Skia/Metal on
+// a Retina display. Weirdly, if the same polygon is repeatedly
+// drawn, the total shift is cumulative so if the drawn polygon
+// is more than a few pixels wide, the blinking cursor in Writer
+// will exhibit this bug but only for one thin vertical slice at
+// a time. Apparently, shifting drawing a very tiny amount to
+// the left seems to be enough to quell this runaway cumulative
+// X coordinate shift.
+if (isGPU())
+{
+SkMatrix aMatrix;
+aMatrix.set(SkMatrix::kMTransX, -0.001);
+getDrawCanvas()->concat(aMatrix);
+}
+#endif
 }
 getDrawCanvas()->drawPath(aPath, aPaint);
 postDraw();


core.git: Branch 'libreoffice-24-2-3' - vcl/source

2024-04-29 Thread Patrick Luby (via logerrit)
 vcl/source/bitmap/BitmapEx.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 24bf5dd70e721fd68df0e2bd06adb85ebaf4ea24
Author: Patrick Luby 
AuthorDate: Sun Apr 28 14:35:42 2024 -0400
Commit: Patrick Luby 
CommitDate: Mon Apr 29 14:13:13 2024 +0200

tdf#160831 only set outside color to black for alpha masks

The outside color still needs to be white for the content
so only apply the fix for tdf#157795 to the alpha mask.

Change-Id: I7486b2c9062ca96bf127f2bce6b1bd5e65d00ff6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166806
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
Tested-by: Jenkins
(cherry picked from commit 5425103fb5a09c7e5e56d077260523438c593e21)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166728
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Patrick Luby 

diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 40feacbf66dd..07e25f177180 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -657,7 +657,7 @@ namespace
 const Bitmap& rSource,
 const Size& rDestinationSize,
 const basegfx::B2DHomMatrix& rTransform,
-bool bSmooth)
+bool bSmooth, bool bAlphaMask)
 {
 Bitmap aDestination(rDestinationSize, vcl::PixelFormat::N24_BPP);
 BitmapScopedWriteAccess xWrite(aDestination);
@@ -673,7 +673,10 @@ namespace
 // tdf#157795 set color to black outside of bitmap bounds
 // Due to commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
 // transparent areas are now black instead of white.
-const BitmapColor aOutside(0x0, 0x0, 0x0);
+// tdf#160831 only set outside color to black for alpha masks
+// The outside color still needs to be white for the content
+// so only apply the fix for tdf#157795 to the alpha mask.
+const BitmapColor aOutside = bAlphaMask ? BitmapColor(0x0, 
0x0, 0x0) : BitmapColor(0xff, 0xff, 0xff);
 
 for(tools::Long y(0); y < aDestinationSizePixel.getHeight(); 
y++)
 {
@@ -759,12 +762,12 @@ BitmapEx BitmapEx::TransformBitmapEx(
 // force destination to 24 bit, we want to smooth output
 const Size aDestinationSize(basegfx::fround(fWidth), 
basegfx::fround(fHeight));
 bool bSmooth = implTransformNeedsSmooth(rTransformation);
-const Bitmap aDestination(impTransformBitmap(GetBitmap(), 
aDestinationSize, rTransformation, bSmooth));
+const Bitmap aDestination(impTransformBitmap(GetBitmap(), 
aDestinationSize, rTransformation, bSmooth, false));
 
 // create mask
 if(IsAlpha())
 {
-const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), 
aDestinationSize, rTransformation, bSmooth));
+const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), 
aDestinationSize, rTransformation, bSmooth, true));
 return BitmapEx(aDestination, AlphaMask(aAlpha));
 }
 


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-04-28 Thread Patrick Luby (via logerrit)
 vcl/source/bitmap/BitmapEx.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit e1a5213427a876ae609635671f6fd6186aea1e67
Author: Patrick Luby 
AuthorDate: Sun Apr 28 14:35:42 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Apr 29 00:47:02 2024 +0200

tdf#160831 only set outside color to black for alpha masks

The outside color still needs to be white for the content
so only apply the fix for tdf#157795 to the alpha mask.

Change-Id: I7486b2c9062ca96bf127f2bce6b1bd5e65d00ff6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166806
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
Tested-by: Jenkins
(cherry picked from commit 5425103fb5a09c7e5e56d077260523438c593e21)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166727
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 40feacbf66dd..07e25f177180 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -657,7 +657,7 @@ namespace
 const Bitmap& rSource,
 const Size& rDestinationSize,
 const basegfx::B2DHomMatrix& rTransform,
-bool bSmooth)
+bool bSmooth, bool bAlphaMask)
 {
 Bitmap aDestination(rDestinationSize, vcl::PixelFormat::N24_BPP);
 BitmapScopedWriteAccess xWrite(aDestination);
@@ -673,7 +673,10 @@ namespace
 // tdf#157795 set color to black outside of bitmap bounds
 // Due to commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
 // transparent areas are now black instead of white.
-const BitmapColor aOutside(0x0, 0x0, 0x0);
+// tdf#160831 only set outside color to black for alpha masks
+// The outside color still needs to be white for the content
+// so only apply the fix for tdf#157795 to the alpha mask.
+const BitmapColor aOutside = bAlphaMask ? BitmapColor(0x0, 
0x0, 0x0) : BitmapColor(0xff, 0xff, 0xff);
 
 for(tools::Long y(0); y < aDestinationSizePixel.getHeight(); 
y++)
 {
@@ -759,12 +762,12 @@ BitmapEx BitmapEx::TransformBitmapEx(
 // force destination to 24 bit, we want to smooth output
 const Size aDestinationSize(basegfx::fround(fWidth), 
basegfx::fround(fHeight));
 bool bSmooth = implTransformNeedsSmooth(rTransformation);
-const Bitmap aDestination(impTransformBitmap(GetBitmap(), 
aDestinationSize, rTransformation, bSmooth));
+const Bitmap aDestination(impTransformBitmap(GetBitmap(), 
aDestinationSize, rTransformation, bSmooth, false));
 
 // create mask
 if(IsAlpha())
 {
-const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), 
aDestinationSize, rTransformation, bSmooth));
+const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), 
aDestinationSize, rTransformation, bSmooth, true));
 return BitmapEx(aDestination, AlphaMask(aAlpha));
 }
 


core.git: vcl/source

2024-04-28 Thread Patrick Luby (via logerrit)
 vcl/source/bitmap/BitmapEx.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 5425103fb5a09c7e5e56d077260523438c593e21
Author: Patrick Luby 
AuthorDate: Sun Apr 28 14:35:42 2024 -0400
Commit: Patrick Luby 
CommitDate: Sun Apr 28 23:05:49 2024 +0200

tdf#160831 only set outside color to black for alpha masks

The outside color still needs to be white for the content
so only apply the fix for tdf#157795 to the alpha mask.

Change-Id: I7486b2c9062ca96bf127f2bce6b1bd5e65d00ff6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166806
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
Tested-by: Jenkins

diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index dfad8876b315..0d1216bb7095 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -639,7 +639,7 @@ namespace
 const Bitmap& rSource,
 const Size& rDestinationSize,
 const basegfx::B2DHomMatrix& rTransform,
-bool bSmooth)
+bool bSmooth, bool bAlphaMask)
 {
 Bitmap aDestination(rDestinationSize, vcl::PixelFormat::N24_BPP);
 BitmapScopedWriteAccess xWrite(aDestination);
@@ -655,7 +655,10 @@ namespace
 // tdf#157795 set color to black outside of bitmap bounds
 // Due to commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
 // transparent areas are now black instead of white.
-const BitmapColor aOutside(0x0, 0x0, 0x0);
+// tdf#160831 only set outside color to black for alpha masks
+// The outside color still needs to be white for the content
+// so only apply the fix for tdf#157795 to the alpha mask.
+const BitmapColor aOutside = bAlphaMask ? BitmapColor(0x0, 
0x0, 0x0) : BitmapColor(0xff, 0xff, 0xff);
 
 for(tools::Long y(0); y < aDestinationSizePixel.getHeight(); 
y++)
 {
@@ -741,12 +744,12 @@ BitmapEx BitmapEx::TransformBitmapEx(
 // force destination to 24 bit, we want to smooth output
 const Size aDestinationSize(basegfx::fround(fWidth), 
basegfx::fround(fHeight));
 bool bSmooth = implTransformNeedsSmooth(rTransformation);
-const Bitmap aDestination(impTransformBitmap(GetBitmap(), 
aDestinationSize, rTransformation, bSmooth));
+const Bitmap aDestination(impTransformBitmap(GetBitmap(), 
aDestinationSize, rTransformation, bSmooth, false));
 
 // create mask
 if(IsAlpha())
 {
-const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), 
aDestinationSize, rTransformation, bSmooth));
+const Bitmap aAlpha(impTransformBitmap(GetAlphaMask().GetBitmap(), 
aDestinationSize, rTransformation, bSmooth, true));
 return BitmapEx(aDestination, AlphaMask(aAlpha));
 }
 


core.git: vcl/skia

2024-04-27 Thread Patrick Luby (via logerrit)
 vcl/skia/gdiimpl.cxx |   20 
 1 file changed, 20 insertions(+)

New commits:
commit 05d3a99aa687ee4e1706f9403651379b7ebdad89
Author: Patrick Luby 
AuthorDate: Fri Apr 26 20:25:03 2024 -0400
Commit: Patrick Luby 
CommitDate: Sat Apr 27 16:35:56 2024 +0200

tdf#153306 prevent subpixel shifting of X coordinate

HACK: for some unknown reason, if the X coordinate of the
path's bounds is more than 1024, SkBlendMode::kExclusion will
shift by about a half a pixel to the right with Skia/Metal on
a Retina display. Weirdly, if the same polygon is repeatedly
drawn, the total shift is cumulative so if the drawn polygon
is more than a few pixels wide, the blinking cursor in Writer
will exhibit this bug but only for one thin vertical slice at
a time. Apparently, shifting drawing a very tiny amount to
the left seems to be enough to quell this runaway cumulative
X coordinate shift.

Change-Id: Ic1ac8a390df51c4aa1cc3183590dce72059af6b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166766
Reviewed-by: Patrick Luby 
Tested-by: Jenkins

diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index f90fbace9d69..4c34d9ab2870 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1508,6 +1508,26 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon 
const& rPoly, SalInvert eFl
 aPaint.setShader(aBitmap.makeShader(SkTileMode::kRepeat, 
SkTileMode::kRepeat,
 SkSamplingOptions()));
 }
+
+#ifdef SK_METAL
+// tdf#153306 prevent subpixel shifting of X coordinate
+// HACK: for some unknown reason, if the X coordinate of the
+// path's bounds is more than 1024, SkBlendMode::kExclusion will
+// shift by about a half a pixel to the right with Skia/Metal on
+// a Retina display. Weirdly, if the same polygon is repeatedly
+// drawn, the total shift is cumulative so if the drawn polygon
+// is more than a few pixels wide, the blinking cursor in Writer
+// will exhibit this bug but only for one thin vertical slice at
+// a time. Apparently, shifting drawing a very tiny amount to
+// the left seems to be enough to quell this runaway cumulative
+// X coordinate shift.
+if (isGPU())
+{
+SkMatrix aMatrix;
+aMatrix.set(SkMatrix::kMTransX, -0.001);
+getDrawCanvas()->concat(aMatrix);
+}
+#endif
 }
 getDrawCanvas()->drawPath(aPath, aPaint);
 }


core.git: Branch 'libreoffice-24-2-3' - vcl/quartz

2024-04-26 Thread Patrick Luby (via logerrit)
 vcl/quartz/cgutils.mm |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit f7579474089bfc67f7d83680d562efa17783e4b4
Author: Patrick Luby 
AuthorDate: Wed Apr 10 08:04:57 2024 -0400
Commit: Patrick Luby 
CommitDate: Fri Apr 26 14:10:05 2024 +0200

tdf#160590 Disable Metal with Intel HD Graphics 6000

Releasing a Metal buffer resource hangs when fetching pixels from a
Skia surface on this Intel MacBook Air built-in GPU.

Change-Id: Ic3028bf8eb45ebb9f6d71879bf5d96f0401a95c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165927
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit fe3a4bdf48f7b2d4f6da31b4392ac5979653cf9c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165946
Reviewed-by: Ilmari Lauhakangas 
Reviewed-by: Adolfo Jayme Barrientos 
Reviewed-by: Michael Stahl 
Tested-by: Patrick Luby 

diff --git a/vcl/quartz/cgutils.mm b/vcl/quartz/cgutils.mm
index 0d611bec11d1..50b7fcd6540c 100644
--- a/vcl/quartz/cgutils.mm
+++ b/vcl/quartz/cgutils.mm
@@ -122,6 +122,16 @@ bool DefaultMTLDeviceIsSupported()
bRet = false;
 }
 
+if (bRet)
+{
+// tdf#160590 Disable Metal with Intel HD Graphics 6000
+// Releasing a Metal buffer resource hangs when fetching pixels from a
+// Skia surface on this Intel MacBook Air built-in GPU.
+   static NSString* pIntelHDGraphics6000Prefix = @"Intel(R) Iris(TM) 
Graphics 6000";
+   if ([pMetalDevice.name hasPrefix:pIntelHDGraphics6000Prefix])
+   bRet = false;
+}
+
 [pMetalDevice release];
 return bRet;
 }


core.git: Branch 'libreoffice-7-6' - vcl/qa vcl/source

2024-04-25 Thread Patrick Luby (via logerrit)
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |6 +-
 vcl/source/gdi/pdfwriter_impl.cxx  |   14 ++
 2 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit 8624309fb63fd95210ac53d06bd0de4652e4b32b
Author: Patrick Luby 
AuthorDate: Mon Apr 22 19:36:14 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Apr 26 05:37:10 2024 +0200

tdf#160714 use crop box for bounds of embedded PDF object

If there is no crop box, fallback to the media box just to be safe.

Change-Id: I29f99a43e550cf09a1534c0aa01ffd6a55536fb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166544
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 4b31f87e918c38a7eb30ceb85563a5c98b426da5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166672
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index d6ae5f527ab8..483910dcf07f 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -45,6 +45,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -7800,7 +7801,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, 
testRexportMediaBoxOrigin)
 = { // Rotation by $   heta$ $cos( heta), sin( heta), -sin(
heta), cos( heta)$
 0, -1, 1, 0,
 // Translate x,y
--aOrigin[1] - aSize[1] / 2 + aSize[0] / 2, aOrigin[0] + aSize[0] / 
2 + aSize[1] / 2
+-aOrigin[1] - aSize[1] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
++ aSize[0] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2,
+aOrigin[0] + aSize[0] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
++ aSize[1] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
   };
 
 for (sal_Int32 nIdx = 0; nIdx < 6; ++nIdx)
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index d3cb95ea7d0a..d104ca9ea1df 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9106,9 +9106,15 @@ void PDFWriterImpl::writeReferenceXObject(const 
ReferenceXObjectEmit& rEmit)
 }
 
 double aOrigin[2] = { 0.0, 0.0 };
-if (auto* pArray = 
dynamic_cast(pPage->Lookup("MediaBox")))
+
+// tdf#160714 use crop box for bounds of embedded PDF object
+// If there is no crop box, fallback to the media box just to be safe.
+auto* pBoundsArray = 
dynamic_cast(pPage->Lookup("CropBox"));
+if (!pBoundsArray)
+pBoundsArray = 
dynamic_cast(pPage->Lookup("MediaBox"));
+if (pBoundsArray)
 {
-const auto& rElements = pArray->GetElements();
+const auto& rElements = pBoundsArray->GetElements();
 if (rElements.size() >= 4)
 {
 // get x1, y1 of the rectangle.
@@ -9221,9 +9227,9 @@ void PDFWriterImpl::writeReferenceXObject(const 
ReferenceXObjectEmit& rEmit)
 // Now transform the object: rotate around the center and make 
sure that the rotation
 // doesn't affect the aspect ratio.
 basegfx::B2DHomMatrix aMat;
-aMat.translate(-0.5 * aBBox.getWidth() - aOrigin[0], -0.5 * 
aBBox.getHeight() - aOrigin[1]);
+aMat.translate((-0.5 * aBBox.getWidth() / fMagicScaleFactor) - 
aOrigin[0], (-0.5 * aBBox.getHeight() / fMagicScaleFactor) - aOrigin[1]);
 aMat.rotate(basegfx::deg2rad(nAngle));
-aMat.translate(0.5 * nWidth, 0.5 * nHeight);
+aMat.translate(0.5 * nWidth / fMagicScaleFactor, 0.5 * nHeight / 
fMagicScaleFactor);
 
 aLine.append(" /Matrix [ ");
 aLine.append(aMat.a());


core.git: Branch 'libreoffice-24-2' - vcl/qa vcl/source

2024-04-25 Thread Patrick Luby (via logerrit)
 vcl/qa/cppunit/pdfexport/pdfexport2.cxx |6 +-
 vcl/source/gdi/pdfwriter_impl.cxx   |   14 ++
 2 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit ca574d5eef68af970cb49f90c7fc4fe813c9009c
Author: Patrick Luby 
AuthorDate: Mon Apr 22 19:36:14 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Apr 26 05:35:48 2024 +0200

tdf#160714 use crop box for bounds of embedded PDF object

If there is no crop box, fallback to the media box just to be safe.

Change-Id: I29f99a43e550cf09a1534c0aa01ffd6a55536fb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166544
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 4b31f87e918c38a7eb30ceb85563a5c98b426da5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166670
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
index 38e3629497fa..a464798076ed 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
@@ -40,6 +40,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -4580,7 +4581,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, 
testRexportMediaBoxOrigin)
 = { // Rotation by $   heta$ $cos( heta), sin( heta), -sin(
heta), cos( heta)$
 0, -1, 1, 0,
 // Translate x,y
--aOrigin[1] - aSize[1] / 2 + aSize[0] / 2, aOrigin[0] + aSize[0] / 
2 + aSize[1] / 2
+-aOrigin[1] - aSize[1] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
++ aSize[0] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2,
+aOrigin[0] + aSize[0] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
++ aSize[1] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
   };
 
 for (sal_Int32 nIdx = 0; nIdx < 6; ++nIdx)
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index fba7a85db430..ff7383d7be99 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9125,9 +9125,15 @@ void PDFWriterImpl::writeReferenceXObject(const 
ReferenceXObjectEmit& rEmit)
 }
 
 double aOrigin[2] = { 0.0, 0.0 };
-if (auto* pArray = 
dynamic_cast(pPage->Lookup("MediaBox"_ostr)))
+
+// tdf#160714 use crop box for bounds of embedded PDF object
+// If there is no crop box, fallback to the media box just to be safe.
+auto* pBoundsArray = 
dynamic_cast(pPage->Lookup("CropBox"_ostr));
+if (!pBoundsArray)
+pBoundsArray = 
dynamic_cast(pPage->Lookup("MediaBox"_ostr));
+if (pBoundsArray)
 {
-const auto& rElements = pArray->GetElements();
+const auto& rElements = pBoundsArray->GetElements();
 if (rElements.size() >= 4)
 {
 // get x1, y1 of the rectangle.
@@ -9240,9 +9246,9 @@ void PDFWriterImpl::writeReferenceXObject(const 
ReferenceXObjectEmit& rEmit)
 // Now transform the object: rotate around the center and make 
sure that the rotation
 // doesn't affect the aspect ratio.
 basegfx::B2DHomMatrix aMat;
-aMat.translate(-0.5 * aBBox.getWidth() - aOrigin[0], -0.5 * 
aBBox.getHeight() - aOrigin[1]);
+aMat.translate((-0.5 * aBBox.getWidth() / fMagicScaleFactor) - 
aOrigin[0], (-0.5 * aBBox.getHeight() / fMagicScaleFactor) - aOrigin[1]);
 aMat.rotate(basegfx::deg2rad(nAngle));
-aMat.translate(0.5 * nWidth, 0.5 * nHeight);
+aMat.translate(0.5 * nWidth / fMagicScaleFactor, 0.5 * nHeight / 
fMagicScaleFactor);
 
 aLine.append(" /Matrix [ ");
 aLine.append(aMat.a());


core.git: vcl/qa vcl/source

2024-04-24 Thread Patrick Luby (via logerrit)
 vcl/qa/cppunit/pdfexport/pdfexport2.cxx |6 +-
 vcl/source/gdi/pdfwriter_impl.cxx   |   14 ++
 2 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit 4b31f87e918c38a7eb30ceb85563a5c98b426da5
Author: Patrick Luby 
AuthorDate: Mon Apr 22 19:36:14 2024 -0400
Commit: Patrick Luby 
CommitDate: Wed Apr 24 20:17:56 2024 +0200

tdf#160714 use crop box for bounds of embedded PDF object

If there is no crop box, fallback to the media box just to be safe.

Change-Id: I29f99a43e550cf09a1534c0aa01ffd6a55536fb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166544
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
index 525f1d91a449..ccaab1d5c9bf 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
@@ -45,6 +45,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -4627,7 +4628,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, 
testRexportMediaBoxOrigin)
 = { // Rotation by $   heta$ $cos( heta), sin( heta), -sin(
heta), cos( heta)$
 0, -1, 1, 0,
 // Translate x,y
--aOrigin[1] - aSize[1] / 2 + aSize[0] / 2, aOrigin[0] + aSize[0] / 
2 + aSize[1] / 2
+-aOrigin[1] - aSize[1] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
++ aSize[0] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2,
+aOrigin[0] + aSize[0] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
++ aSize[1] / vcl::PDF_INSERT_MAGIC_SCALE_FACTOR / 2
   };
 
 for (sal_Int32 nIdx = 0; nIdx < 6; ++nIdx)
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index d780b0c4f88e..cf5a5fc39546 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9124,9 +9124,15 @@ void PDFWriterImpl::writeReferenceXObject(const 
ReferenceXObjectEmit& rEmit)
 }
 
 double aOrigin[2] = { 0.0, 0.0 };
-if (auto* pArray = 
dynamic_cast(pPage->Lookup("MediaBox"_ostr)))
+
+// tdf#160714 use crop box for bounds of embedded PDF object
+// If there is no crop box, fallback to the media box just to be safe.
+auto* pBoundsArray = 
dynamic_cast(pPage->Lookup("CropBox"_ostr));
+if (!pBoundsArray)
+pBoundsArray = 
dynamic_cast(pPage->Lookup("MediaBox"_ostr));
+if (pBoundsArray)
 {
-const auto& rElements = pArray->GetElements();
+const auto& rElements = pBoundsArray->GetElements();
 if (rElements.size() >= 4)
 {
 // get x1, y1 of the rectangle.
@@ -9239,9 +9245,9 @@ void PDFWriterImpl::writeReferenceXObject(const 
ReferenceXObjectEmit& rEmit)
 // Now transform the object: rotate around the center and make 
sure that the rotation
 // doesn't affect the aspect ratio.
 basegfx::B2DHomMatrix aMat;
-aMat.translate(-0.5 * aBBox.getWidth() - aOrigin[0], -0.5 * 
aBBox.getHeight() - aOrigin[1]);
+aMat.translate((-0.5 * aBBox.getWidth() / fMagicScaleFactor) - 
aOrigin[0], (-0.5 * aBBox.getHeight() / fMagicScaleFactor) - aOrigin[1]);
 aMat.rotate(basegfx::deg2rad(nAngle));
-aMat.translate(0.5 * nWidth, 0.5 * nHeight);
+aMat.translate(0.5 * nWidth / fMagicScaleFactor, 0.5 * nHeight / 
fMagicScaleFactor);
 
 aLine.append(" /Matrix [ ");
 aLine.append(aMat.a());


core.git: Branch 'distro/collabora/co-24.04' - vcl/ios

2024-04-14 Thread Patrick Luby (via logerrit)
 vcl/ios/clipboard.cxx |   77 +-
 vcl/ios/clipboard.hxx |   15 +
 2 files changed, 91 insertions(+), 1 deletion(-)

New commits:
commit b16637b716479fcbd50acb47673df7e6d2fbdb61
Author: Patrick Luby 
AuthorDate: Sat Apr 13 19:46:48 2024 -0400
Commit: Andras Timar 
CommitDate: Mon Apr 15 07:20:46 2024 +0200

cool#5839 fire a clipboard changed event in the iOS app

A clipboard changed event needs to be fired whenever the
native general pasteboard changes. Otherwise, if the clipboard
is empty when a document is opened, the Paste and Paste Special
menu items and toolbar buttons will be disabled and will never
be enabled even after something has been copied to the general
pasteboard.

Change-Id: I8a70a2ac4de55593a886233d144dc18c3c57178e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166073
Reviewed-by: Patrick Luby 
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/vcl/ios/clipboard.cxx b/vcl/ios/clipboard.cxx
index 59209504da31..109f744e87c8 100644
--- a/vcl/ios/clipboard.cxx
+++ b/vcl/ios/clipboard.cxx
@@ -29,6 +29,56 @@
 #include 
 #include 
 
+@implementation PasteboardChangedEventListener
+
+- (PasteboardChangedEventListener*)initWithiOSClipboard:(iOSClipboard*)pcb
+{
+self = [super init];
+
+if (self)
+{
+// Just to be safe, set clipboard to a nullptr to ignore any
+// synchronous callbacks that might occur when adding the observer
+piOSClipboard = nullptr;
+
+[[NSNotificationCenter defaultCenter] addObserver:self
+ 
selector:@selector(pasteboardChanged:)
+ 
name:UIPasteboardChangedNotification
+   object:[UIPasteboard 
generalPasteboard]];
+
+// According to following, no UIPasteboardChangedNotification
+// notifications are received when an app is not active. So, post the
+// notification so that the LibreOffice vcl/ios code can handle any
+// clipboard changes:
+//   
https://stackoverflow.com/questions/4240087/receiving-uipasteboard-generalpasteboard-notification-while-in-the-background
+// Note: UIApplicationDidBecomeActiveNotification is never sent when
+// running in Mac Catalyst so listen for UISceneDidActivateNotification
+// instead.
+[[NSNotificationCenter defaultCenter] addObserver:self
+ 
selector:@selector(pasteboardChanged:)
+ 
name:UISceneDidActivateNotification
+   object:nil];
+
+piOSClipboard = pcb;
+}
+
+return self;
+}
+
+- (void)pasteboardChanged:(NSNotification*)aNotification
+{
+if (piOSClipboard)
+piOSClipboard->contentsChanged();
+}
+
+- (void)disposing
+{
+piOSClipboard = nullptr;
+[[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+@end
+
 iOSClipboard::iOSClipboard()
 : WeakComponentImplHelper(m_aMutex)
 {
@@ -37,9 +87,17 @@ iOSClipboard::iOSClipboard()
 mrXMimeCntFactory = 
css::datatransfer::MimeContentTypeFactory::create(xContext);
 
 mpDataFlavorMapper.reset(new DataFlavorMapper());
+
+mnPasteboardChangeCount = 0;
+mpPasteboardChangedEventListener =
+[[PasteboardChangedEventListener alloc] initWithiOSClipboard:this];
 }
 
-iOSClipboard::~iOSClipboard() {}
+iOSClipboard::~iOSClipboard()
+{
+[mpPasteboardChangedEventListener disposing];
+[mpPasteboardChangedEventListener release];
+}
 
 css::uno::Reference SAL_CALL 
iOSClipboard::getContents()
 {
@@ -173,6 +231,23 @@ css::uno::Sequence SAL_CALL 
iOSClipboard::getSupportedServiceNames()
 return { OUString("com.sun.star.datatransfer.clipboard.SystemClipboard") };
 }
 
+void iOSClipboard::contentsChanged()
+{
+NSInteger nPasteboardChangeCount = [[UIPasteboard generalPasteboard] 
changeCount];
+if (mnPasteboardChangeCount != nPasteboardChangeCount)
+{
+// cool#5839 fire a clipboard changed event in the iOS app
+// A clipboard changed event needs to be fired whenever the
+// native general pasteboard changes. Otherwise, if the clipboard
+// is empty when a document is opened, the Paste and Paste Special
+// menu items and toolbar buttons will be disabled and will never
+// be enabled even after something has been copied to the general
+// pasteboard.
+mnPasteboardChangeCount = nPasteboardChangeCount;
+fireClipboardChangedEvent(getContents());
+}
+}
+
 css::uno::Reference
 IosSalInstance::CreateClipboard(const css::uno::Sequence&)
 {
diff --git a/vcl/ios/clipboard.hxx b/vcl/ios/clipboard.hxx
index 086840912650..e1133f0ba0bf 100644
--- a/vcl/ios/clipboard.hxx
+++ b/vcl/ios/clipboard.hxx
@@ -41,6 +41,17 

core.git: Branch 'libreoffice-24-2' - vcl/quartz

2024-04-13 Thread Patrick Luby (via logerrit)
 vcl/quartz/cgutils.mm |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit acb6430800fccd120765110a3822c422fbc9a19d
Author: Patrick Luby 
AuthorDate: Wed Apr 10 08:04:57 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Apr 13 21:13:01 2024 +0200

tdf#160590 Disable Metal with Intel HD Graphics 6000

Releasing a Metal buffer resource hangs when fetching pixels from a
Skia surface on this Intel MacBook Air built-in GPU.

Change-Id: Ic3028bf8eb45ebb9f6d71879bf5d96f0401a95c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165927
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit fe3a4bdf48f7b2d4f6da31b4392ac5979653cf9c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165945
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/quartz/cgutils.mm b/vcl/quartz/cgutils.mm
index 0d611bec11d1..50b7fcd6540c 100644
--- a/vcl/quartz/cgutils.mm
+++ b/vcl/quartz/cgutils.mm
@@ -122,6 +122,16 @@ bool DefaultMTLDeviceIsSupported()
bRet = false;
 }
 
+if (bRet)
+{
+// tdf#160590 Disable Metal with Intel HD Graphics 6000
+// Releasing a Metal buffer resource hangs when fetching pixels from a
+// Skia surface on this Intel MacBook Air built-in GPU.
+   static NSString* pIntelHDGraphics6000Prefix = @"Intel(R) Iris(TM) 
Graphics 6000";
+   if ([pMetalDevice.name hasPrefix:pIntelHDGraphics6000Prefix])
+   bRet = false;
+}
+
 [pMetalDevice release];
 return bRet;
 }


core.git: Branch 'libreoffice-24-2' - vcl/skia

2024-04-11 Thread Patrick Luby (via logerrit)
 vcl/skia/osx/gdiimpl.cxx |   21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit dd769dd028dad7b67709e6c4268c595d1916a9e7
Author: Patrick Luby 
AuthorDate: Thu Feb 22 10:01:00 2024 -0500
Commit: Christian Lohmaier 
CommitDate: Thu Apr 11 19:20:17 2024 +0200

Related: tdf#159529 eliminate possible memory leak

Despite confirming that the release function passed to
SkBitmap.bitmap.installPixels() does get called for every
data array that has been allocated, Apple's Instruments
indicates that the data is leaking. While it is likely a
false positive, it makes leak analysis difficult so leave
the bitmap mutable. That causes SkBitmap.asImage() to make
a copy of the data and the data can be safely deleted here.

Change-Id: Ib28d70bd5f51e6d3be7a7d7c0d5923d71a6e5390
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163774
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 3e2dde97bc15f156837d10bf4456deb81f7f554a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165187
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx
index c4bd75184242..9b511ad4469b 100644
--- a/vcl/skia/osx/gdiimpl.cxx
+++ b/vcl/skia/osx/gdiimpl.cxx
@@ -37,12 +37,6 @@
 
 using namespace SkiaHelper;
 
-static void releaseInstalledPixels(void* pAddr, void*)
-{
-if (pAddr)
-delete[] static_cast(pAddr);
-}
-
 AquaSkiaSalGraphicsImpl::AquaSkiaSalGraphicsImpl(AquaSalGraphics& rParent,
  AquaSharedAttributes& rShared)
 : SkiaSalGraphicsImpl(rParent, rShared.mpFrame)
@@ -251,6 +245,7 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType 
nType, ControlPart n
 if (!context)
 {
 SAL_WARN("vcl.skia", "drawNativeControl(): Failed to allocate bitmap 
context");
+delete[] data;
 return false;
 }
 // Setup context state for drawing (performDrawNativeControl() e.g. fills 
background in some cases).
@@ -287,12 +282,9 @@ bool 
AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n
 if (!bitmap.installPixels(SkImageInfo::Make(width, height,
 
mSurface->imageInfo().colorType(),
 kPremul_SkAlphaType),
-  data, width * 4, releaseInstalledPixels, 
nullptr))
+  data, width * 4, nullptr, nullptr))
 abort();
 
-// Make bitmap immutable to avoid making a copy in bitmap.asImage()
-bitmap.setImmutable();
-
 preDraw();
 SAL_INFO("vcl.skia.trace", "drawnativecontrol(" << this << "): " << 
rControlRegion << ":"
 << int(nType) << "/" 
<< int(nPart));
@@ -312,6 +304,15 @@ bool 
AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n
 ++pendingOperationsToFlush; // tdf#136369
 postDraw();
 }
+// Related: tdf#159529 eliminate possible memory leak
+// Despite confirming that the release function passed to
+// SkBitmap.bitmap.installPixels() does get called for every
+// data array that has been allocated, Apple's Instruments
+//  indicates that the data is leaking. While it is likely a
+// false positive, it makes leak analysis difficult so leave
+// the bitmap mutable. That causes SkBitmap.asImage() to make
+// a copy of the data and the data can be safely deleted here.
+delete[] data;
 return bOK;
 }
 


core.git: vcl/quartz

2024-04-10 Thread Patrick Luby (via logerrit)
 vcl/quartz/cgutils.mm |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit fe3a4bdf48f7b2d4f6da31b4392ac5979653cf9c
Author: Patrick Luby 
AuthorDate: Wed Apr 10 08:04:57 2024 -0400
Commit: Patrick Luby 
CommitDate: Wed Apr 10 17:59:32 2024 +0200

tdf#160590 Disable Metal with Intel HD Graphics 6000

Releasing a Metal buffer resource hangs when fetching pixels from a
Skia surface on this Intel MacBook Air built-in GPU.

Change-Id: Ic3028bf8eb45ebb9f6d71879bf5d96f0401a95c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165927
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/quartz/cgutils.mm b/vcl/quartz/cgutils.mm
index 0d611bec11d1..50b7fcd6540c 100644
--- a/vcl/quartz/cgutils.mm
+++ b/vcl/quartz/cgutils.mm
@@ -122,6 +122,16 @@ bool DefaultMTLDeviceIsSupported()
bRet = false;
 }
 
+if (bRet)
+{
+// tdf#160590 Disable Metal with Intel HD Graphics 6000
+// Releasing a Metal buffer resource hangs when fetching pixels from a
+// Skia surface on this Intel MacBook Air built-in GPU.
+   static NSString* pIntelHDGraphics6000Prefix = @"Intel(R) Iris(TM) 
Graphics 6000";
+   if ([pMetalDevice.name hasPrefix:pIntelHDGraphics6000Prefix])
+   bRet = false;
+}
+
 [pMetalDevice release];
 return bRet;
 }


core.git: Branch 'libreoffice-7-6' - desktop/source

2024-04-07 Thread Patrick Luby (via logerrit)
 desktop/source/deployment/registry/package/dp_package.cxx |   17 +-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 47ca58be2941e67c9304cf47d4beba93bdf74ffc
Author: Patrick Luby 
AuthorDate: Wed Apr 3 17:34:49 2024 -0400
Commit: Noel Grandin 
CommitDate: Sun Apr 7 20:12:16 2024 +0200

tdf#159790 temporarily release mutex for child packages

This code is normally run on a separate thread so if a
child package tries to acquire the solar mutex, a deadlock
can occur if the main thread calls isRegistered() on this
package or any of its parents. So, temporarily release
this package's mutex while registering the child package.

Change-Id: I45b534c44d5946637a5441927ed01a68aad4c448
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165766
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit cab028121bd9b620529b6492b3247ac48ac2082b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165832
Reviewed-by: Patrick Luby 

diff --git a/desktop/source/deployment/registry/package/dp_package.cxx 
b/desktop/source/deployment/registry/package/dp_package.cxx
index 0eb02321a74f..6bd8b02bc7d7 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -781,7 +781,7 @@ uno::Reference< graphic::XGraphic > 
BackendImpl::PackageImpl::getIcon( sal_Bool
 
 
 void BackendImpl::PackageImpl::processPackage_(
-::osl::ResettableMutexGuard &,
+::osl::ResettableMutexGuard & guard,
 bool doRegisterPackage,
 bool startup,
 ::rtl::Reference const & abortChannel,
@@ -802,10 +802,20 @@ void BackendImpl::PackageImpl::processPackage_(
 xPackage->createAbortChannel() );
 AbortChannel::Chain chain( abortChannel, xSubAbortChannel );
 try {
+// tdf#159790 temporarily release mutex for child packages
+// This code is normally run on a separate thread so if a
+// child package tries to acquire the solar mutex, a deadlock
+// can occur if the main thread calls isRegistered() on this
+// package or any of its parents. So, temporarily release
+// this package's mutex while registering the child package.
+guard.clear();
 xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv 
);
+guard.reset();
 }
 catch (const Exception &)
 {
+guard.reset();
+
//We even try a rollback if the user cancelled the action 
(CommandAbortedException)
 //in order to prevent invalid database entries.
 Any exc( ::cppu::getCaughtException() );
@@ -856,6 +866,11 @@ void BackendImpl::PackageImpl::processPackage_(
 ::cppu::throwException(exc);
 }
 }
+catch (...) {
+guard.reset();
+throw;
+}
+
 data.items.emplace_back(xPackage->getURL(),
  xPackage->getPackageType()->getMediaType());
 }


help.git: Changes to 'refs/tags/cp-24.04.1-2'

2024-04-07 Thread Patrick Luby (via logerrit)
Tag 'cp-24.04.1-2' created by Andras Timar  at 
2024-04-07 12:16 +

cp-24.04.1-2

Changes since cp-24.04.1-1-4:
---
 0 files changed
---


core.git: Branch 'libreoffice-24-2' - desktop/source

2024-04-07 Thread Patrick Luby (via logerrit)
 desktop/source/deployment/registry/package/dp_package.cxx |   17 +-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 96a40862fa010d9022247524913ac51e1d8b189a
Author: Patrick Luby 
AuthorDate: Wed Apr 3 17:34:49 2024 -0400
Commit: Noel Grandin 
CommitDate: Sun Apr 7 11:36:16 2024 +0200

tdf#159790 temporarily release mutex for child packages

This code is normally run on a separate thread so if a
child package tries to acquire the solar mutex, a deadlock
can occur if the main thread calls isRegistered() on this
package or any of its parents. So, temporarily release
this package's mutex while registering the child package.

Change-Id: I45b534c44d5946637a5441927ed01a68aad4c448
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165766
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit cab028121bd9b620529b6492b3247ac48ac2082b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165831
Reviewed-by: Patrick Luby 

diff --git a/desktop/source/deployment/registry/package/dp_package.cxx 
b/desktop/source/deployment/registry/package/dp_package.cxx
index 6af2fb5515f5..d5c1feeb4992 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -781,7 +781,7 @@ uno::Reference< graphic::XGraphic > 
BackendImpl::PackageImpl::getIcon( sal_Bool
 
 
 void BackendImpl::PackageImpl::processPackage_(
-::osl::ResettableMutexGuard &,
+::osl::ResettableMutexGuard & guard,
 bool doRegisterPackage,
 bool startup,
 ::rtl::Reference const & abortChannel,
@@ -802,10 +802,20 @@ void BackendImpl::PackageImpl::processPackage_(
 xPackage->createAbortChannel() );
 AbortChannel::Chain chain( abortChannel, xSubAbortChannel );
 try {
+// tdf#159790 temporarily release mutex for child packages
+// This code is normally run on a separate thread so if a
+// child package tries to acquire the solar mutex, a deadlock
+// can occur if the main thread calls isRegistered() on this
+// package or any of its parents. So, temporarily release
+// this package's mutex while registering the child package.
+guard.clear();
 xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv 
);
+guard.reset();
 }
 catch (const Exception &)
 {
+guard.reset();
+
//We even try a rollback if the user cancelled the action 
(CommandAbortedException)
 //in order to prevent invalid database entries.
 Any exc( ::cppu::getCaughtException() );
@@ -856,6 +866,11 @@ void BackendImpl::PackageImpl::processPackage_(
 ::cppu::throwException(exc);
 }
 }
+catch (...) {
+guard.reset();
+throw;
+}
+
 data.items.emplace_back(xPackage->getURL(),
  xPackage->getPackageType()->getMediaType());
 }


core.git: desktop/source

2024-04-04 Thread Patrick Luby (via logerrit)
 desktop/source/deployment/registry/package/dp_package.cxx |   17 +-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit cab028121bd9b620529b6492b3247ac48ac2082b
Author: Patrick Luby 
AuthorDate: Wed Apr 3 17:34:49 2024 -0400
Commit: Noel Grandin 
CommitDate: Thu Apr 4 08:01:19 2024 +0200

tdf#159790 temporarily release mutex for child packages

This code is normally run on a separate thread so if a
child package tries to acquire the solar mutex, a deadlock
can occur if the main thread calls isRegistered() on this
package or any of its parents. So, temporarily release
this package's mutex while registering the child package.

Change-Id: I45b534c44d5946637a5441927ed01a68aad4c448
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165766
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/desktop/source/deployment/registry/package/dp_package.cxx 
b/desktop/source/deployment/registry/package/dp_package.cxx
index 6af2fb5515f5..d5c1feeb4992 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -781,7 +781,7 @@ uno::Reference< graphic::XGraphic > 
BackendImpl::PackageImpl::getIcon( sal_Bool
 
 
 void BackendImpl::PackageImpl::processPackage_(
-::osl::ResettableMutexGuard &,
+::osl::ResettableMutexGuard & guard,
 bool doRegisterPackage,
 bool startup,
 ::rtl::Reference const & abortChannel,
@@ -802,10 +802,20 @@ void BackendImpl::PackageImpl::processPackage_(
 xPackage->createAbortChannel() );
 AbortChannel::Chain chain( abortChannel, xSubAbortChannel );
 try {
+// tdf#159790 temporarily release mutex for child packages
+// This code is normally run on a separate thread so if a
+// child package tries to acquire the solar mutex, a deadlock
+// can occur if the main thread calls isRegistered() on this
+// package or any of its parents. So, temporarily release
+// this package's mutex while registering the child package.
+guard.clear();
 xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv 
);
+guard.reset();
 }
 catch (const Exception &)
 {
+guard.reset();
+
//We even try a rollback if the user cancelled the action 
(CommandAbortedException)
 //in order to prevent invalid database entries.
 Any exc( ::cppu::getCaughtException() );
@@ -856,6 +866,11 @@ void BackendImpl::PackageImpl::processPackage_(
 ::cppu::throwException(exc);
 }
 }
+catch (...) {
+guard.reset();
+throw;
+}
+
 data.items.emplace_back(xPackage->getURL(),
  xPackage->getPackageType()->getMediaType());
 }


core.git: Branch 'libreoffice-24-2' - desktop/source

2024-04-02 Thread Patrick Luby (via logerrit)
 desktop/source/deployment/registry/configuration/dp_configuration.cxx |8 
++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 27279b82c4e98271db9e999200c70ee8cba11c38
Author: Patrick Luby 
AuthorDate: Tue Apr 2 10:38:58 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Apr 3 00:01:01 2024 +0200

tdf#159790 eliminate deadlock on main thread

A separate thread may have already acquired m_aMutex and that
thread will then try to acquire the solar mutex. However, when
the main thread calls this method, the main thread has already
acquired the solar mutex.

So, drop the desktop mutex before calling out.

Change-Id: Ic87063266ac5101b866df9f24067a403e1417745
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165682
Reviewed-by: Patrick Luby 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 89e23bb599104d3bde30878148e15cf4deb1593f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165629
Reviewed-by: Adolfo Jayme Barrientos 

diff --git 
a/desktop/source/deployment/registry/configuration/dp_configuration.cxx 
b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 622814248670..ceba81f9470a 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -654,7 +654,7 @@ OUString replaceOrigin(
 
 
 void BackendImpl::PackageImpl::processPackage_(
-::osl::ResettableMutexGuard &,
+::osl::ResettableMutexGuard & guard,
 bool doRegisterPackage,
 bool startup,
 ::rtl::Reference const &,
@@ -689,7 +689,10 @@ void BackendImpl::PackageImpl::processPackage_(
 if ((that->m_eContext != Context::Bundled && !startup)
  || comphelper::LibreOfficeKit::isActive())
 {
-if (m_isSchema)
+bool bIsSchema = m_isSchema;
+// tdf#159790 prevent lock-ordering deadlock, the code below 
might acquire the solar mutex
+guard.clear();
+if (bIsSchema)
 {
 css::configuration::Update::get(
 that->m_xComponentContext)->insertExtensionXcsFile(
@@ -701,6 +704,7 @@ void BackendImpl::PackageImpl::processPackage_(
 that->m_xComponentContext)->insertExtensionXcuFile(
 that->m_eContext == Context::Shared, 
expandUnoRcUrl(url));
 }
+guard.reset();
 }
 that->addToConfigmgrIni( m_isSchema, true, url, xCmdEnv );
 data.iniEntry = dp_misc::makeRcTerm(url);


core.git: Branch 'libreoffice-7-6' - desktop/source

2024-04-02 Thread Patrick Luby (via logerrit)
 desktop/source/deployment/registry/configuration/dp_configuration.cxx |8 
++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 677b13aa5c695b44ada7a0b11d6c9b91fc38ff51
Author: Patrick Luby 
AuthorDate: Tue Apr 2 10:38:58 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Apr 2 23:22:56 2024 +0200

tdf#159790 eliminate deadlock on main thread

A separate thread may have already acquired m_aMutex and that
thread will then try to acquire the solar mutex. However, when
the main thread calls this method, the main thread has already
acquired the solar mutex.

So, drop the desktop mutex before calling out.

Change-Id: Ic87063266ac5101b866df9f24067a403e1417745
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165682
Reviewed-by: Patrick Luby 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 89e23bb599104d3bde30878148e15cf4deb1593f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165710
Reviewed-by: Adolfo Jayme Barrientos 

diff --git 
a/desktop/source/deployment/registry/configuration/dp_configuration.cxx 
b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 622814248670..ceba81f9470a 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -654,7 +654,7 @@ OUString replaceOrigin(
 
 
 void BackendImpl::PackageImpl::processPackage_(
-::osl::ResettableMutexGuard &,
+::osl::ResettableMutexGuard & guard,
 bool doRegisterPackage,
 bool startup,
 ::rtl::Reference const &,
@@ -689,7 +689,10 @@ void BackendImpl::PackageImpl::processPackage_(
 if ((that->m_eContext != Context::Bundled && !startup)
  || comphelper::LibreOfficeKit::isActive())
 {
-if (m_isSchema)
+bool bIsSchema = m_isSchema;
+// tdf#159790 prevent lock-ordering deadlock, the code below 
might acquire the solar mutex
+guard.clear();
+if (bIsSchema)
 {
 css::configuration::Update::get(
 that->m_xComponentContext)->insertExtensionXcsFile(
@@ -701,6 +704,7 @@ void BackendImpl::PackageImpl::processPackage_(
 that->m_xComponentContext)->insertExtensionXcuFile(
 that->m_eContext == Context::Shared, 
expandUnoRcUrl(url));
 }
+guard.reset();
 }
 that->addToConfigmgrIni( m_isSchema, true, url, xCmdEnv );
 data.iniEntry = dp_misc::makeRcTerm(url);


core.git: desktop/source

2024-04-02 Thread Patrick Luby (via logerrit)
 desktop/source/deployment/registry/configuration/dp_configuration.cxx |8 
++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 89e23bb599104d3bde30878148e15cf4deb1593f
Author: Patrick Luby 
AuthorDate: Tue Apr 2 10:38:58 2024 -0400
Commit: Noel Grandin 
CommitDate: Tue Apr 2 21:10:19 2024 +0200

tdf#159790 eliminate deadlock on main thread

A separate thread may have already acquired m_aMutex and that
thread will then try to acquire the solar mutex. However, when
the main thread calls this method, the main thread has already
acquired the solar mutex.

So, drop the desktop mutex before calling out.

Change-Id: Ic87063266ac5101b866df9f24067a403e1417745
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165682
Reviewed-by: Patrick Luby 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git 
a/desktop/source/deployment/registry/configuration/dp_configuration.cxx 
b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 3bfac940bce6..9ef3cc969432 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -653,7 +653,7 @@ OUString replaceOrigin(
 
 
 void BackendImpl::PackageImpl::processPackage_(
-::osl::ResettableMutexGuard &,
+::osl::ResettableMutexGuard & guard,
 bool doRegisterPackage,
 bool startup,
 ::rtl::Reference const &,
@@ -688,7 +688,10 @@ void BackendImpl::PackageImpl::processPackage_(
 if ((that->m_eContext != Context::Bundled && !startup)
  || comphelper::LibreOfficeKit::isActive())
 {
-if (m_isSchema)
+bool bIsSchema = m_isSchema;
+// tdf#159790 prevent lock-ordering deadlock, the code below 
might acquire the solar mutex
+guard.clear();
+if (bIsSchema)
 {
 css::configuration::Update::get(
 that->m_xComponentContext)->insertExtensionXcsFile(
@@ -700,6 +703,7 @@ void BackendImpl::PackageImpl::processPackage_(
 that->m_xComponentContext)->insertExtensionXcuFile(
 that->m_eContext == Context::Shared, 
expandUnoRcUrl(url));
 }
+guard.reset();
 }
 that->addToConfigmgrIni( m_isSchema, true, url, xCmdEnv );
 data.iniEntry = dp_misc::makeRcTerm(url);


core.git: Branch 'libreoffice-24-2' - svx/source

2024-04-01 Thread Patrick Luby (via logerrit)
 svx/source/svdraw/svdpntv.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 4241a641a433511ae9c3e1795de445a25eab14d8
Author: Patrick Luby 
AuthorDate: Mon Apr 1 10:01:03 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Apr 2 01:36:49 2024 +0200

tdf#160444 check device's owner window is a nullptr

Since commit 563f7077f1dbce31ff95ee8d2e8d17b629693db1, the
device's owner window gets deleted before this object is
deleted.

Change-Id: I15dc8db60e5520c2f0e73a9a117f25af15845caf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165637
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit d034036a049d6dcc8dc62a8e44c1e4befcaa25b0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165623
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index f0928872509a..780227f4a117 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -858,7 +858,12 @@ void SdrPaintView::InvalidateAllWin(const 
tools::Rectangle& rRect)
 void SdrPaintView::InvalidateOneWin(OutputDevice& rDevice)
 {
 // do not erase background, that causes flicker (!)
-rDevice.GetOwnerWindow()->Invalidate(InvalidateFlags::NoErase);
+// tdf#160444 check device's owner window is a nullptr
+// Since commit 563f7077f1dbce31ff95ee8d2e8d17b629693db1, the
+// device's owner window gets deleted before this object is
+// deleted.
+if (rDevice.GetOwnerWindow())
+rDevice.GetOwnerWindow()->Invalidate(InvalidateFlags::NoErase);
 }
 
 void SdrPaintView::InvalidateOneWin(OutputDevice& rDevice, const 
tools::Rectangle& rRect)


core.git: svx/source

2024-04-01 Thread Patrick Luby (via logerrit)
 svx/source/svdraw/svdpntv.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 053f7f9ff5a475446da2855e2e71f3ea0ef18791
Author: Patrick Luby 
AuthorDate: Mon Apr 1 10:01:03 2024 -0400
Commit: Patrick Luby 
CommitDate: Mon Apr 1 19:27:17 2024 +0200

tdf#160444 check device's owner window is a nullptr

Since commit 563f7077f1dbce31ff95ee8d2e8d17b629693db1, the
device's owner window gets deleted before this object is
deleted.

Change-Id: I15dc8db60e5520c2f0e73a9a117f25af15845caf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165637
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 86535232d288..09583787fa24 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -858,7 +858,12 @@ void SdrPaintView::InvalidateAllWin(const 
tools::Rectangle& rRect)
 void SdrPaintView::InvalidateOneWin(OutputDevice& rDevice)
 {
 // do not erase background, that causes flicker (!)
-rDevice.GetOwnerWindow()->Invalidate(InvalidateFlags::NoErase);
+// tdf#160444 check device's owner window is a nullptr
+// Since commit 563f7077f1dbce31ff95ee8d2e8d17b629693db1, the
+// device's owner window gets deleted before this object is
+// deleted.
+if (rDevice.GetOwnerWindow())
+rDevice.GetOwnerWindow()->Invalidate(InvalidateFlags::NoErase);
 }
 
 void SdrPaintView::InvalidateOneWin(OutputDevice& rDevice, const 
tools::Rectangle& rRect)


core.git: offapi/com

2024-03-28 Thread Patrick Luby (via logerrit)
 offapi/com/sun/star/security/XDocumentDigitalSignatures.idl |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 27b68ea28aecfce3007ed304399ee84190f4f747
Author: Patrick Luby 
AuthorDate: Thu Mar 28 07:37:05 2024 -0400
Commit: Patrick Luby 
CommitDate: Thu Mar 28 18:10:21 2024 +0100

Correct typo in comment

Typo was added in commit 6a049e417b029f3733fcee05f99a3e8875aefdb8.

Change-Id: Icfe61fde3b199505ae2107f1b790cf94ac98c456
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165462
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl 
b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
index dc1a5f160bde..cba242258601 100644
--- a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
+++ b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
@@ -213,7 +213,7 @@ interface XDocumentDigitalSignatures : 
com::sun::star::uno::XInterface
 [in] 
::com::sun::star::embed::XStorage xStorage,
 [in] 
::com::sun::star::io::XStream xStream);
 
-/** queries the user if the want to trust an untrusted certificate.
+/** queries the user if they want to trust an untrusted certificate.
 
 @since LibreOffice 24.8
 */


core.git: xmlsecurity/inc

2024-03-27 Thread Patrick Luby (via logerrit)
 xmlsecurity/inc/strings.hrc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c4023d3ec604abfff38be2053e2989c7ec2ba8c1
Author: Patrick Luby 
AuthorDate: Tue Mar 26 17:39:35 2024 -0400
Commit: Thorsten Behrens 
CommitDate: Thu Mar 28 01:02:45 2024 +0100

Related: tdf#160184 clearly describe security risk

Encrypting with untrusted public keys increases the risk of
"man-in-the-middle" attacks so emphasize this risk.

Change-Id: I48cbb7b002c5f17bdac3372bf94c1bc18ea68566
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165396
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
Reviewed-by: Thorsten Behrens 

diff --git a/xmlsecurity/inc/strings.hrc b/xmlsecurity/inc/strings.hrc
index 69b62a06dafe..7ed55690f97b 100644
--- a/xmlsecurity/inc/strings.hrc
+++ b/xmlsecurity/inc/strings.hrc
@@ -65,6 +65,6 @@
 
 #define STR_BROKEN_MACRO_CERTIFICATE_DATA   
NC_("STR_BROKEN_MACRO_CERTIFICATE_DATA", "Macro security problem!

Broken certificate data: %{data}")
 #define STR_RELOAD_FILE_WARNING 
NC_("STR_RELOAD_FILE_WARNING", "Reload the file to apply the new macro security 
level")
-#define STR_TRUST_UNTRUSTED_PUBKEY   
NC_("STR_TRUST_UNTRUSTED_PUBKEY", "The following OpenPGP public key is not 
trusted:

%{data}

Do you want to use this untrusted OpenPGP public key?")
+#define STR_TRUST_UNTRUSTED_PUBKEY   
NC_("STR_TRUST_UNTRUSTED_PUBKEY", "Security warning: the following OpenPGP 
public key is untrusted:

%{data}

Encrypting with an untrusted public key increases the risk of a 
\"man-in-the-middle\" attack. A successful \"man-in-the-middle\" attack gives 
malicious third parties the ability to decrypt your document.

Do you really want to encrypt your document with this untrusted public key?")
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: Branch 'distro/collabora/co-24.04' - helpcontent2

2024-03-27 Thread Patrick Luby (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 72b8daf0a813e199ca6ccb991ff6277e0584904e
Author: Patrick Luby 
AuthorDate: Wed Mar 27 14:28:24 2024 +0100
Commit: Gerrit Code Review 
CommitDate: Wed Mar 27 14:28:24 2024 +0100

Update git submodules

* Update helpcontent2 from branch 'distro/collabora/co-24.04'
  to b43d32f0218caaeb880c06d490d0b99972a50614
  - tdf#159326 macOS uses Command+Option+F while other plafforms use Ctrl+H

Change-Id: Iee37805afba1aa712a45c213d1f9eeae4d01d923
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162452
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 509ec415db94a821da1c8f7bacf9e372d320e49d)
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162534
Reviewed-by: Patrick Luby 
Reviewed-by: Olivier Hallot 

  - related tdf#160057: replace ref to obsolete Footer Header page

Change-Id: Ie6df598c42149ecc527a1a2eef35a7aba469c216
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/164387
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 
(cherry picked from commit 04dcd1b951689689f9449408fd6f512a9c87aa0d)
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/164991

  - tdf#156156: add Animation sidebar deck help button's HID

Change-Id: Ia0500321f9216aff4f249f9088694f6cd1fa1a80
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/161217
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

  - tdf#156156: add Manage Changes sidebar decks help button's HID

Change-Id: Ibeab9e20ea4f8684b8d0a8a535b30c3122e4df70
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/161165
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

  - fix Helpex warnings: 'No string specified!'

Change-Id: I70ad73b6859cd989e6046c3bd5a76c54c27f416d
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/164631
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 
(cherry picked from commit 99537726eca951a450182d7672458afeb2b65e66)
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/164615
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/helpcontent2 b/helpcontent2
index e5d0bcb12bde..b43d32f0218c 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit e5d0bcb12bde1a726205c3e21338a625fba625a5
+Subproject commit b43d32f0218caaeb880c06d490d0b99972a50614


help.git: Branch 'distro/collabora/co-24.04' - 5 commits - helpers/unocmds.txt source/text

2024-03-27 Thread Patrick Luby (via logerrit)
 helpers/unocmds.txt  |2 +-
 source/text/shared/01/02230400.xhp   |1 +
 source/text/shared/04/0101.xhp   |2 +-
 source/text/shared/guide/pdf_params.xhp  |4 ++--
 source/text/shared/guide/usingthemes.xhp |1 -
 source/text/simpress/01/0606.xhp |1 +
 6 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit b43d32f0218caaeb880c06d490d0b99972a50614
Author: Patrick Luby 
AuthorDate: Tue Jan 23 14:17:57 2024 +0100
Commit: Andras Timar 
CommitDate: Wed Mar 27 14:28:03 2024 +0100

tdf#159326 macOS uses Command+Option+F while other plafforms use Ctrl+H

Change-Id: Iee37805afba1aa712a45c213d1f9eeae4d01d923
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162452
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 509ec415db94a821da1c8f7bacf9e372d320e49d)
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162534
Reviewed-by: Patrick Luby 
Reviewed-by: Olivier Hallot 

diff --git a/source/text/shared/04/0101.xhp 
b/source/text/shared/04/0101.xhp
index 6ce842fd24..b13f80396c 100644
--- a/source/text/shared/04/0101.xhp
+++ b/source/text/shared/04/0101.xhp
@@ -240,7 +240,7 @@
   
   
 
-  CommandCtrl+H
+  Command+Option+FCtrl+H
 
 
   Calls 
the Find  Replace dialog.
commit 186c44a744ca836ae177c497f73884935139796c
Author: Stéphane Guillou 
AuthorDate: Wed Mar 6 12:23:37 2024 +0100
Commit: Andras Timar 
CommitDate: Wed Mar 27 14:28:03 2024 +0100

related tdf#160057: replace ref to obsolete Footer Header page

Change-Id: Ie6df598c42149ecc527a1a2eef35a7aba469c216
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/164387
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 
(cherry picked from commit 04dcd1b951689689f9449408fd6f512a9c87aa0d)
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/164991

diff --git a/helpers/unocmds.txt b/helpers/unocmds.txt
index e5ece05cf1..835c1f4817 100644
--- a/helpers/unocmds.txt
+++ b/helpers/unocmds.txt
@@ -338,7 +338,7 @@
 .uno:EditDoc;shared/02/0707.xhp
 .uno:EditFootnote;swriter/01/0215.xhp
 .uno:EditGlossary;swriter/01/0212.xhp
-.uno:EditHeaderAndFooter;scalc/01/0212.xhp
+.uno:EditHeaderAndFooter;scalc/01/02120100.xhp
 .uno:EditHyperlink;shared/02/0907.xhp
 .uno:EditLinks;shared/01/0218.xhp
 .uno:EditPrintArea;scalc/01/05080300.xhp
commit 16b3c98d0a52682088fe443478607aa44c331435
Author: Stéphane Guillou 
AuthorDate: Fri Dec 22 16:17:09 2023 +0100
Commit: Andras Timar 
CommitDate: Wed Mar 27 14:28:03 2024 +0100

tdf#156156: add Animation sidebar deck help button's HID

Change-Id: Ia0500321f9216aff4f249f9088694f6cd1fa1a80
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/161217
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/source/text/simpress/01/0606.xhp 
b/source/text/simpress/01/0606.xhp
index b3c695d854..6a51b64d83 100644
--- a/source/text/simpress/01/0606.xhp
+++ b/source/text/simpress/01/0606.xhp
@@ -39,6 +39,7 @@
 animations;list of
 
 
+
 
 
 Animation 
Pane
commit 79e56b8511a3967abd6afe0dbd480ae7b5ba36ab
Author: Stéphane Guillou 
AuthorDate: Mon Mar 11 07:14:31 2024 +1000
Commit: Andras Timar 
CommitDate: Wed Mar 27 14:28:03 2024 +0100

tdf#156156: add Manage Changes sidebar decks help button's HID

Change-Id: Ibeab9e20ea4f8684b8d0a8a535b30c3122e4df70
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/161165
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/source/text/shared/01/02230400.xhp 
b/source/text/shared/01/02230400.xhp
index 107b773128..38de1cfc24 100644
--- a/source/text/shared/01/02230400.xhp
+++ b/source/text/shared/01/02230400.xhp
@@ -29,6 +29,7 @@
 
 
   
+  
   
   
   
commit 9b6113566dfc66bab41f24d2eb1cfb00baf1c9de
Author: Andras Timar 
AuthorDate: Sun Mar 10 11:51:52 2024 +0100
Commit: Andras Timar 
CommitDate: Wed Mar 27 14:28:03 2024 +0100

fix Helpex warnings: 'No string specified!'

Change-Id: I70ad73b6859cd989e6046c3bd5a76c54c27f416d
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/164631
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 
(cherry picked from commit 99537726eca951a450182d7672458afeb2b65e66)
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/164615
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/source/text/shared/guide/pdf_params.xhp 
b/source/text/shared/guide/pdf_params.xhp
index 04d172be1d..04d51074dd 100644
--- a/source/text/shared/guide/pdf_params.xhp
+++ b/source/text/shared/guide/pdf_params.xhp
@@ -926,7 +926,7 @@
 PreparedPasswords
 
 
-
+
 
 
 
@@ -940,7 +940,7 @@
 PreparedPermissionPassword
 
 
-
+
 
 
 string
diff --git 

help.git: Branch 'libreoffice-24-2' - source/text

2024-03-27 Thread Patrick Luby (via logerrit)
 source/text/shared/04/0101.xhp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 02a11cfe8fb608fdf77b4ce5a57a5dd23784f8ec
Author: Patrick Luby 
AuthorDate: Tue Jan 23 14:17:57 2024 +0100
Commit: Olivier Hallot 
CommitDate: Wed Mar 27 12:18:00 2024 +0100

tdf#159326 macOS uses Command+Option+F while other plafforms use Ctrl+H

Change-Id: Iee37805afba1aa712a45c213d1f9eeae4d01d923
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162452
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 509ec415db94a821da1c8f7bacf9e372d320e49d)
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162534
Reviewed-by: Patrick Luby 
Reviewed-by: Olivier Hallot 

diff --git a/source/text/shared/04/0101.xhp 
b/source/text/shared/04/0101.xhp
index 6ce842fd24..b13f80396c 100644
--- a/source/text/shared/04/0101.xhp
+++ b/source/text/shared/04/0101.xhp
@@ -240,7 +240,7 @@
   
   
 
-  CommandCtrl+H
+  Command+Option+FCtrl+H
 
 
   Calls 
the Find  Replace dialog.


core.git: Branch 'libreoffice-24-2' - helpcontent2

2024-03-27 Thread Patrick Luby (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 15c04b923b7b86b3f63b9ea62b0005ea101f9217
Author: Patrick Luby 
AuthorDate: Wed Mar 27 12:18:01 2024 +0100
Commit: Gerrit Code Review 
CommitDate: Wed Mar 27 12:18:01 2024 +0100

Update git submodules

* Update helpcontent2 from branch 'libreoffice-24-2'
  to 02a11cfe8fb608fdf77b4ce5a57a5dd23784f8ec
  - tdf#159326 macOS uses Command+Option+F while other plafforms use Ctrl+H

Change-Id: Iee37805afba1aa712a45c213d1f9eeae4d01d923
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162452
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 509ec415db94a821da1c8f7bacf9e372d320e49d)
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162534
Reviewed-by: Patrick Luby 
Reviewed-by: Olivier Hallot 

diff --git a/helpcontent2 b/helpcontent2
index 9bed20d260f9..02a11cfe8fb6 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 9bed20d260f9c0dfd5a43f62bba288aff829da85
+Subproject commit 02a11cfe8fb608fdf77b4ce5a57a5dd23784f8ec


core.git: comphelper/source offapi/com sfx2/source xmlsecurity/inc xmlsecurity/source

2024-03-26 Thread Patrick Luby (via logerrit)
 comphelper/source/misc/storagehelper.cxx|   38 ++--
 offapi/com/sun/star/security/XDocumentDigitalSignatures.idl |6 +
 sfx2/source/dialog/filedlghelper.cxx|2 
 xmlsecurity/inc/strings.hrc |1 
 xmlsecurity/source/component/documentdigitalsignatures.cxx  |   14 
 5 files changed, 56 insertions(+), 5 deletions(-)

New commits:
commit 6a049e417b029f3733fcee05f99a3e8875aefdb8
Author: Patrick Luby 
AuthorDate: Sun Mar 24 12:46:45 2024 -0400
Commit: Thorsten Behrens 
CommitDate: Tue Mar 26 10:01:31 2024 +0100

tdf#160184 ask user if they want to trust an untrusted certificate

gpgme contexts uses the "auto" trust model by default which only
allows encrypting with keys that have their trust level set to
"Ultimate". The gpg command, however, gives the user the option
to encrypt with a certificate that has a lower trust level so
emulate that bahavior by asking the user if they want to trust
the certificate for just this operation only.

Also, abort saving if no certificates are selected which is an
indication that the user cancelled the Select Certificate dialog.

Change-Id: I20951b1e31b2dcf8adb82243742f8c00fbaca8c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165260
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
Reviewed-by: Thorsten Behrens 

diff --git a/comphelper/source/misc/storagehelper.cxx 
b/comphelper/source/misc/storagehelper.cxx
index 1d504cb91725..3812bf023915 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -476,13 +476,18 @@ uno::Sequence< beans::NamedValue > 
OStorageHelper::CreateGpgPackageEncryptionDat
 if (err)
 throw uno::RuntimeException("The GpgME library failed to initialize 
for the OpenPGP protocol.");
 
-ctx.reset( GpgME::Context::createForProtocol(GpgME::OpenPGP) );
-if (ctx == nullptr)
-throw uno::RuntimeException("The GpgME library failed to initialize 
for the OpenPGP protocol.");
-ctx->setArmor(false);
-
+bool bResetContext = true;
 for (const auto & cert : xSignCertificates)
 {
+if (bResetContext)
+{
+bResetContext = false;
+ctx.reset( GpgME::Context::createForProtocol(GpgME::OpenPGP) );
+if (ctx == nullptr)
+throw uno::RuntimeException("The GpgME library failed to 
initialize for the OpenPGP protocol.");
+ctx->setArmor(false);
+}
+
 uno::Sequence < sal_Int8 > aKeyID;
 if (cert.is())
 aKeyID = cert->getSHA1Thumbprint();
@@ -504,6 +509,29 @@ uno::Sequence< beans::NamedValue > 
OStorageHelper::CreateGpgPackageEncryptionDat
 keys, plain,
 cipher, GpgME::Context::NoCompress);
 
+// tdf#160184 ask user if they want to trust an untrusted certificate
+// gpgme contexts uses the "auto" trust model by default which only
+// allows encrypting with keys that have their trust level set to
+// "Ultimate". The gpg command, however, gives the user the option
+// to encrypt with a certificate that has a lower trust level so
+// emulate that bahavior by asking the user if they want to trust
+// the certificate for just this operation only.
+if (crypt_res.error().code() == GPG_ERR_UNUSABLE_PUBKEY)
+{
+if (xSigner->trustUntrustedCertificate(cert))
+{
+// Reset the trust model back to "auto" before processing
+// the next certificate
+bResetContext = true;
+
+ctx->setFlag("trust-model", "tofu+pgp");
+ctx->setFlag("tofu-default-policy", "unknown");
+crypt_res = ctx->encrypt(
+keys, plain,
+cipher, GpgME::Context::NoCompress);
+}
+}
+
 off_t result = cipher.seek(0,SEEK_SET);
 (void) result;
 assert(result == 0);
diff --git a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl 
b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
index a90304313582..a32f77970996 100644
--- a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
+++ b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl
@@ -212,6 +212,12 @@ interface XDocumentDigitalSignatures : 
com::sun::star::uno::XInterface
 boolean signPackageWithCertificate([in] 
::com::sun::star::security::XCertificate xCertificate,
 [in] 
::com::sun::star::embed::XStorage xStorage,
 [in] 
::com::sun::star::io::XStream xStream);
+
+/** queries the user if the want to trust an untrusted certificate.
+
+@since LibreOffice 24.2.3
+*/
+boolean trustUntrustedCertificate([in] 
::com::sun::star::security::XCertificate xCertificate);
 };
 
 } 

core.git: Branch 'libreoffice-7-6' - external/gpgmepp

2024-03-23 Thread Patrick Luby (via logerrit)
 external/gpgmepp/UnpackedTarball_gpgmepp.mk |1 
 external/gpgmepp/macos-tdf152524.patch  |  102 
 2 files changed, 103 insertions(+)

New commits:
commit 74e3a9e4dce18b2acd400b5a350a31605b5cc0e2
Author: Patrick Luby 
AuthorDate: Fri Mar 22 09:44:51 2024 -0400
Commit: Patrick Luby 
CommitDate: Sat Mar 23 18:25:15 2024 +0100

tdf#152524 fix crash by changing the macOS fork() and exec() process

This fix backports commit 839cf255e2670fdf8e974af38432aacf63be4e90
and commit 3c6c5ef5d1c4f555b465bf56cf9d99e4d67224cc.

Change-Id: I5dd397a1ab624a048c8892c870b991b381a94f9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165181
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 

diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk 
b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
index f2dd62cefe89..061a62ec1bcf 100644
--- a/external/gpgmepp/UnpackedTarball_gpgmepp.mk
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -37,5 +37,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
 external/gpgmepp/0001-cpp-Fix-building-with-C-11.patch.1 \
 external/gpgmepp/macos-include.patch \
 external/gpgmepp/macos-macports-path.patch \
+external/gpgmepp/macos-tdf152524.patch \
 ))
 # vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
new file mode 100644
index ..c1cdd047dba8
--- /dev/null
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -0,0 +1,102 @@
+--- src/posix-io.c 2023-02-01 11:50:48
 src/posix-io.c 2024-03-21 09:50:24
+@@ -67,6 +67,13 @@
+ #include "priv-io.h"
+ #include "sema.h"
+ #include "debug.h"
++
++#if HAVE_MACOS_SYSTEM
++#include 
++#include 
++
++extern char **environ;
++#endif
+ 
+ 
+ #ifdef USE_LINUX_GETDENTS
+@@ -515,6 +522,15 @@
+ }
+   return 0;
+ }
++
++
++#if HAVE_MACOS_SYSTEM
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++ struct spawn_fd_item_s *fd_list,
++ void (*atfork) (void *opaque, int reserved),
++ void *atforkvalue, pid_t *r_pid);
++#endif /*HAVE_MACOS_SYSTEM*/
+ 
+ 
+ /* Returns 0 on success, -1 on error.  */
+@@ -523,6 +539,35 @@
+struct spawn_fd_item_s *fd_list,
+void (*atfork) (void *opaque, int reserved),
+void *atforkvalue, pid_t *r_pid)
++#if HAVE_MACOS_SYSTEM
++{
++  /* tdf#152524 fork() and exec() in a separate libdispatch queue
++   * This is another attempt to stop the crashing in libdispatch by
++   * running fork() and exec() within a libdispatch task that will
++   * run in a sequential queue in a non-main thread.  */
++  static dispatch_queue_t queue = NULL;
++  if (!queue)
++  queue = dispatch_queue_create ("gpgmepp",
++ DISPATCH_QUEUE_CONCURRENT);
++  if (!queue)
++  return -1;
++
++  __block int ret = -1;
++  dispatch_sync(queue, ^{
++  ret = _gpgme_io_spawn_macos (path, argv, flags,
++   fd_list, atfork,
++   atforkvalue, r_pid);
++  });
++
++  return ret;
++}
++
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++ struct spawn_fd_item_s *fd_list,
++ void (*atfork) (void *opaque, int reserved),
++ void *atforkvalue, pid_t *r_pid)
++#endif /*HAVE_MACOS_SYSTEM*/
+ {
+   pid_t pid;
+   int i;
+@@ -552,8 +597,15 @@
+   if (!pid)
+ {
+   /* Intermediate child to prevent zombie processes.  */
++#if HAVE_MACOS_SYSTEM
++  /* tdf#152524 fix crash by skipping second fork()
++   * Instead of calling a second fork() in the child process, replace
++   * execv() with posix_spawn(). posix_spawn() does not call any atfork
++   * handlers so the atfork handler that crashes will be skipped.  */
++#else /*HAVE_MACOS_SYSTEM*/
+   if ((pid = fork ()) == 0)
+   {
++#endif /*HAVE_MACOS_SYSTEM*/
+ /* Child.  */
+   int max_fds = -1;
+   int fd;
+@@ -664,6 +716,9 @@
+   close (fd);
+   }
+ 
++#if HAVE_MACOS_SYSTEM
++_exit(posix_spawn(NULL, path, NULL, NULL, argv, environ));
++#else /*HAVE_MACOS_SYSTEM*/
+ execv (path, (char *const *) argv);
+ /* Hmm: in that case we could write a special status code to the
+status-pipe.  */
+@@ -674,6 +729,7 @@
+   _exit (1);
+   else
+   _exit (0);
++#endif /*HAVE_MACOS_SYSTEM*/
+ }
+ 
+   TRACE_LOG  ("waiting for child process pid=%i", pid);


core.git: Branch 'libreoffice-24-2-2' - external/gpgmepp

2024-03-22 Thread Patrick Luby (via logerrit)
 external/gpgmepp/UnpackedTarball_gpgmepp.mk |1 
 external/gpgmepp/macos-tdf152524.patch  |  102 
 2 files changed, 103 insertions(+)

New commits:
commit 9012b402ec25c5eb17400f93ffdc73e3db3a122a
Author: Patrick Luby 
AuthorDate: Fri Mar 22 09:44:51 2024 -0400
Commit: Christian Lohmaier 
CommitDate: Fri Mar 22 20:29:52 2024 +0100

tdf#152524 fix crash by changing the macOS fork() and exec() process

This fix backports commit 839cf255e2670fdf8e974af38432aacf63be4e90
and commit 3c6c5ef5d1c4f555b465bf56cf9d99e4d67224cc.

Change-Id: I5dd397a1ab624a048c8892c870b991b381a94f9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165178
Reviewed-by: Caolán McNamara 
Reviewed-by: Patrick Luby 
Tested-by: Christian Lohmaier 
Reviewed-by: Christian Lohmaier 

diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk 
b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
index d7b7a8ab4dbe..dcbda38d591d 100644
--- a/external/gpgmepp/UnpackedTarball_gpgmepp.mk
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -34,5 +34,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
 external/gpgmepp/w32-include.patch \
 external/gpgmepp/Wincompatible-function-pointer-types.patch \
 external/gpgmepp/macos-macports-path.patch \
+external/gpgmepp/macos-tdf152524.patch \
 ))
 # vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
new file mode 100644
index ..c1cdd047dba8
--- /dev/null
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -0,0 +1,102 @@
+--- src/posix-io.c 2023-02-01 11:50:48
 src/posix-io.c 2024-03-21 09:50:24
+@@ -67,6 +67,13 @@
+ #include "priv-io.h"
+ #include "sema.h"
+ #include "debug.h"
++
++#if HAVE_MACOS_SYSTEM
++#include 
++#include 
++
++extern char **environ;
++#endif
+ 
+ 
+ #ifdef USE_LINUX_GETDENTS
+@@ -515,6 +522,15 @@
+ }
+   return 0;
+ }
++
++
++#if HAVE_MACOS_SYSTEM
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++ struct spawn_fd_item_s *fd_list,
++ void (*atfork) (void *opaque, int reserved),
++ void *atforkvalue, pid_t *r_pid);
++#endif /*HAVE_MACOS_SYSTEM*/
+ 
+ 
+ /* Returns 0 on success, -1 on error.  */
+@@ -523,6 +539,35 @@
+struct spawn_fd_item_s *fd_list,
+void (*atfork) (void *opaque, int reserved),
+void *atforkvalue, pid_t *r_pid)
++#if HAVE_MACOS_SYSTEM
++{
++  /* tdf#152524 fork() and exec() in a separate libdispatch queue
++   * This is another attempt to stop the crashing in libdispatch by
++   * running fork() and exec() within a libdispatch task that will
++   * run in a sequential queue in a non-main thread.  */
++  static dispatch_queue_t queue = NULL;
++  if (!queue)
++  queue = dispatch_queue_create ("gpgmepp",
++ DISPATCH_QUEUE_CONCURRENT);
++  if (!queue)
++  return -1;
++
++  __block int ret = -1;
++  dispatch_sync(queue, ^{
++  ret = _gpgme_io_spawn_macos (path, argv, flags,
++   fd_list, atfork,
++   atforkvalue, r_pid);
++  });
++
++  return ret;
++}
++
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++ struct spawn_fd_item_s *fd_list,
++ void (*atfork) (void *opaque, int reserved),
++ void *atforkvalue, pid_t *r_pid)
++#endif /*HAVE_MACOS_SYSTEM*/
+ {
+   pid_t pid;
+   int i;
+@@ -552,8 +597,15 @@
+   if (!pid)
+ {
+   /* Intermediate child to prevent zombie processes.  */
++#if HAVE_MACOS_SYSTEM
++  /* tdf#152524 fix crash by skipping second fork()
++   * Instead of calling a second fork() in the child process, replace
++   * execv() with posix_spawn(). posix_spawn() does not call any atfork
++   * handlers so the atfork handler that crashes will be skipped.  */
++#else /*HAVE_MACOS_SYSTEM*/
+   if ((pid = fork ()) == 0)
+   {
++#endif /*HAVE_MACOS_SYSTEM*/
+ /* Child.  */
+   int max_fds = -1;
+   int fd;
+@@ -664,6 +716,9 @@
+   close (fd);
+   }
+ 
++#if HAVE_MACOS_SYSTEM
++_exit(posix_spawn(NULL, path, NULL, NULL, argv, environ));
++#else /*HAVE_MACOS_SYSTEM*/
+ execv (path, (char *const *) argv);
+ /* Hmm: in that case we could write a special status code to the
+status-pipe.  */
+@@ -674,6 +729,7 @@
+   _exit (1);
+   else
+   _exit (0);
++#endif /*HAVE_MACOS_SYSTEM*/
+ }
+ 
+   TRACE_LOG  ("waiting for child process pid=%i", pid);


core.git: Branch 'libreoffice-24-2' - external/gpgmepp

2024-03-22 Thread Patrick Luby (via logerrit)
 external/gpgmepp/UnpackedTarball_gpgmepp.mk |1 
 external/gpgmepp/macos-tdf152524.patch  |  102 
 2 files changed, 103 insertions(+)

New commits:
commit be132c413c49175a27a55cfe3e42c748b5660a92
Author: Patrick Luby 
AuthorDate: Fri Mar 22 09:44:51 2024 -0400
Commit: Christian Lohmaier 
CommitDate: Fri Mar 22 20:29:33 2024 +0100

tdf#152524 fix crash by changing the macOS fork() and exec() process

This fix backports commit 839cf255e2670fdf8e974af38432aacf63be4e90
and commit 3c6c5ef5d1c4f555b465bf56cf9d99e4d67224cc.

Change-Id: I5dd397a1ab624a048c8892c870b991b381a94f9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165174
Reviewed-by: Patrick Luby 
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk 
b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
index d7b7a8ab4dbe..dcbda38d591d 100644
--- a/external/gpgmepp/UnpackedTarball_gpgmepp.mk
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -34,5 +34,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
 external/gpgmepp/w32-include.patch \
 external/gpgmepp/Wincompatible-function-pointer-types.patch \
 external/gpgmepp/macos-macports-path.patch \
+external/gpgmepp/macos-tdf152524.patch \
 ))
 # vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
new file mode 100644
index ..c1cdd047dba8
--- /dev/null
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -0,0 +1,102 @@
+--- src/posix-io.c 2023-02-01 11:50:48
 src/posix-io.c 2024-03-21 09:50:24
+@@ -67,6 +67,13 @@
+ #include "priv-io.h"
+ #include "sema.h"
+ #include "debug.h"
++
++#if HAVE_MACOS_SYSTEM
++#include 
++#include 
++
++extern char **environ;
++#endif
+ 
+ 
+ #ifdef USE_LINUX_GETDENTS
+@@ -515,6 +522,15 @@
+ }
+   return 0;
+ }
++
++
++#if HAVE_MACOS_SYSTEM
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++ struct spawn_fd_item_s *fd_list,
++ void (*atfork) (void *opaque, int reserved),
++ void *atforkvalue, pid_t *r_pid);
++#endif /*HAVE_MACOS_SYSTEM*/
+ 
+ 
+ /* Returns 0 on success, -1 on error.  */
+@@ -523,6 +539,35 @@
+struct spawn_fd_item_s *fd_list,
+void (*atfork) (void *opaque, int reserved),
+void *atforkvalue, pid_t *r_pid)
++#if HAVE_MACOS_SYSTEM
++{
++  /* tdf#152524 fork() and exec() in a separate libdispatch queue
++   * This is another attempt to stop the crashing in libdispatch by
++   * running fork() and exec() within a libdispatch task that will
++   * run in a sequential queue in a non-main thread.  */
++  static dispatch_queue_t queue = NULL;
++  if (!queue)
++  queue = dispatch_queue_create ("gpgmepp",
++ DISPATCH_QUEUE_CONCURRENT);
++  if (!queue)
++  return -1;
++
++  __block int ret = -1;
++  dispatch_sync(queue, ^{
++  ret = _gpgme_io_spawn_macos (path, argv, flags,
++   fd_list, atfork,
++   atforkvalue, r_pid);
++  });
++
++  return ret;
++}
++
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++ struct spawn_fd_item_s *fd_list,
++ void (*atfork) (void *opaque, int reserved),
++ void *atforkvalue, pid_t *r_pid)
++#endif /*HAVE_MACOS_SYSTEM*/
+ {
+   pid_t pid;
+   int i;
+@@ -552,8 +597,15 @@
+   if (!pid)
+ {
+   /* Intermediate child to prevent zombie processes.  */
++#if HAVE_MACOS_SYSTEM
++  /* tdf#152524 fix crash by skipping second fork()
++   * Instead of calling a second fork() in the child process, replace
++   * execv() with posix_spawn(). posix_spawn() does not call any atfork
++   * handlers so the atfork handler that crashes will be skipped.  */
++#else /*HAVE_MACOS_SYSTEM*/
+   if ((pid = fork ()) == 0)
+   {
++#endif /*HAVE_MACOS_SYSTEM*/
+ /* Child.  */
+   int max_fds = -1;
+   int fd;
+@@ -664,6 +716,9 @@
+   close (fd);
+   }
+ 
++#if HAVE_MACOS_SYSTEM
++_exit(posix_spawn(NULL, path, NULL, NULL, argv, environ));
++#else /*HAVE_MACOS_SYSTEM*/
+ execv (path, (char *const *) argv);
+ /* Hmm: in that case we could write a special status code to the
+status-pipe.  */
+@@ -674,6 +729,7 @@
+   _exit (1);
+   else
+   _exit (0);
++#endif /*HAVE_MACOS_SYSTEM*/
+ }
+ 
+   TRACE_LOG  ("waiting for child process pid=%i", pid);


core.git: external/gpgmepp

2024-03-22 Thread Patrick Luby (via logerrit)
 external/gpgmepp/macos-tdf152524.patch |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b499f32c44babe8f60a6eef51bda6adb9b1cf54d
Author: Patrick Luby 
AuthorDate: Fri Mar 22 09:40:03 2024 -0400
Commit: Patrick Luby 
CommitDate: Fri Mar 22 16:46:48 2024 +0100

Clean up path in diff header line

Change-Id: I181c8c0f41bd4367c622352797f4c493e16c02c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165165
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
index 2d328e4bde7d..c1cdd047dba8 100644
--- a/external/gpgmepp/macos-tdf152524.patch
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -1,5 +1,5 @@
 --- src/posix-io.c 2023-02-01 11:50:48
-+++ /Users/pluby/posix-io.c2024-03-21 09:50:24
 src/posix-io.c 2024-03-21 09:50:24
 @@ -67,6 +67,13 @@
  #include "priv-io.h"
  #include "sema.h"


core.git: Branch 'libreoffice-24-2' - include/svtools include/vcl sc/source svtools/source vcl/source vcl/unx

2024-03-21 Thread Patrick Luby (via logerrit)
 include/svtools/scrolladaptor.hxx|2 +
 include/vcl/toolkit/scrbar.hxx   |3 ++
 include/vcl/weld.hxx |1 
 sc/source/ui/inc/tabview.hxx |2 -
 sc/source/ui/view/tabview.cxx|   22 +--
 sc/source/ui/view/tabview4.cxx   |   45 +--
 svtools/source/control/scrolladaptor.cxx |2 +
 vcl/source/app/salvtables.cxx|2 +
 vcl/source/control/scrbar.cxx|6 ++--
 vcl/unx/gtk3/gtkinst.cxx |5 +++
 10 files changed, 76 insertions(+), 14 deletions(-)

New commits:
commit 227e51b6b4b3e6664c6ed9cc72c85ff3c3d03ab9
Author: Patrick Luby 
AuthorDate: Sun Mar 17 19:04:21 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Mar 21 21:56:23 2024 +0100

tdf#93352 Fix horizontal swiping and scrolling when using an RTL UI

Starting with commit bfa21ce5fa08f2c634ccb6162914be55aef9f3c2,
horizontal swiping in Calc moved in the wrong direction scrollbars
were drawn mirrored.

So, revert parts of commit bfa21ce5fa08f2c634ccb6162914be55aef9f3c2
so that we are using Calc's previous "negative scrollbar range"
implementation for RTL UIs, but only for horizontal scrollbars since
vertical scrollbars are the same in LTR and RTL UIs.

Also, always disable RTL for scrollbars. Enabling RTL causes the
following bugs when clicking or dragging the mouse in scrollbars in
Calc's RTL UI:
- Click or drag events get mirrored so you must click or drag in
  unexpected locations to move the scrollbar thumb in the desired
  direction
- Repeatedly dragging the scrollbar thumb leftward can only move
  no highter than the R, S, or T columns

Note: even though RTL is always disabled for Calc scrollbars, the arrows
must still be swapped in vcl's ScrollBar class.

Change-Id: I85aac94ffaf7df2eeb251a3ff150cc0363b5d770
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164959
Reviewed-by: Stéphane Guillou 
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit ac1024765d203496bc7d28cb3ed3a6d2215c53ad)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165116
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/include/svtools/scrolladaptor.hxx 
b/include/svtools/scrolladaptor.hxx
index cdc507078cf8..1eba1dfdf844 100644
--- a/include/svtools/scrolladaptor.hxx
+++ b/include/svtools/scrolladaptor.hxx
@@ -71,6 +71,8 @@ public:
 
 void SetThickness(int nThickness);
 
+void SetSwapArrows(bool bSwap = true);
+
 ScrollAdaptor(vcl::Window* pParent, bool bHori);
 virtual void dispose() override;
 };
diff --git a/include/vcl/toolkit/scrbar.hxx b/include/vcl/toolkit/scrbar.hxx
index 6981b64fa622..363755fc4168 100644
--- a/include/vcl/toolkit/scrbar.hxx
+++ b/include/vcl/toolkit/scrbar.hxx
@@ -57,6 +57,7 @@ private:
 ScrollType  meScrollType;
 boolmbCalcSize;
 boolmbFullDrag;
+boolmbSwapArrows;
 Link   maScrollHdl;
 Link   maEndScrollHdl;
 
@@ -132,6 +133,8 @@ public:
 voidSetEndScrollHdl( const Link& rLink ) { 
maEndScrollHdl = rLink; }
 
 virtual SizeGetOptimalSize() const override;
+
+voidSetSwapArrows( bool bSwap ) { mbSwapArrows = bSwap; }
 };
 
 
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 2d8c4db085d6..fc585bdb1071 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2576,6 +2576,7 @@ public:
 
 virtual int get_scroll_thickness() const = 0;
 virtual void set_scroll_thickness(int nThickness) = 0;
+virtual void set_scroll_swap_arrows(bool bSwap) = 0;
 
 virtual ScrollType get_scroll_type() const = 0;
 
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 66bbc010eae1..e13488e3026a 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -241,7 +241,7 @@ private:
 voidUpdateVarZoom();
 
 static void SetScrollBar( ScrollAdaptor& rScroll, tools::Long 
nRangeMax, tools::Long nVisible, tools::Long nPos, bool bLayoutRTL );
-static tools::Long GetScrollBarPos( const ScrollAdaptor& rScroll );
+static tools::Long GetScrollBarPos( const ScrollAdaptor& rScroll, bool 
bLayoutRTL );
 
 voidGetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, 
ScFollowMode eMode,
SCCOL& rAreaX, SCROW& rAreaY, 
ScFollowMode& rMode,
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 9eff50195e84..a69ab1447f6c 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1091,7 +1091,7 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll)
 nViewPos = aViewData.GetPosY( (pScroll == aVScrollTop.get()) ?
 SC_SPLIT_TOP : SC_SPLIT_BOTTOM );
 
-bool bLayoutRTL = 

core.git: external/gpgmepp

2024-03-21 Thread Patrick Luby (via logerrit)
 external/gpgmepp/macos-tdf152524.patch |   66 ++---
 1 file changed, 52 insertions(+), 14 deletions(-)

New commits:
commit 3c6c5ef5d1c4f555b465bf56cf9d99e4d67224cc
Author: Patrick Luby 
AuthorDate: Thu Mar 21 10:00:49 2024 -0400
Commit: Patrick Luby 
CommitDate: Thu Mar 21 20:42:53 2024 +0100

tdf#152524 fix crash by skipping second fork()

Instead of calling a second fork() in the child process, replace
execv() with posix_spawn(). posix_spawn() does not call any atfork
handlers so the atfork handler that crashes will be skipped.

Change-Id: Iffb70fe4f51b6b324f13e4ac24b740da0a25da99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165103
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
index a69fbd1cf139..2d328e4bde7d 100644
--- a/external/gpgmepp/macos-tdf152524.patch
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -1,20 +1,25 @@
 --- src/posix-io.c 2023-02-01 11:50:48
-+++ src/posix-io.c 2024-02-05 19:16:00
-@@ -62,6 +62,10 @@
- # endif
- #endif
- #include 
 /Users/pluby/posix-io.c2024-03-21 09:50:24
+@@ -67,6 +67,13 @@
+ #include "priv-io.h"
+ #include "sema.h"
+ #include "debug.h"
 +
 +#if HAVE_MACOS_SYSTEM
 +#include 
++#include 
++
++extern char **environ;
 +#endif
  
- #include "util.h"
- #include "priv-io.h"
-@@ -517,12 +521,50 @@
- }
- 
  
+ #ifdef USE_LINUX_GETDENTS
+@@ -515,6 +522,15 @@
+ }
+   return 0;
+ }
++
++
 +#if HAVE_MACOS_SYSTEM
 +static int
 +_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
@@ -22,11 +27,10 @@
 + void (*atfork) (void *opaque, int reserved),
 + void *atforkvalue, pid_t *r_pid);
 +#endif /*HAVE_MACOS_SYSTEM*/
-+
-+
+ 
+ 
  /* Returns 0 on success, -1 on error.  */
- int
- _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
+@@ -523,6 +539,35 @@
 struct spawn_fd_item_s *fd_list,
 void (*atfork) (void *opaque, int reserved),
 void *atforkvalue, pid_t *r_pid)
@@ -62,3 +66,37 @@
  {
pid_t pid;
int i;
+@@ -552,8 +597,15 @@
+   if (!pid)
+ {
+   /* Intermediate child to prevent zombie processes.  */
++#if HAVE_MACOS_SYSTEM
++  /* tdf#152524 fix crash by skipping second fork()
++   * Instead of calling a second fork() in the child process, replace
++   * execv() with posix_spawn(). posix_spawn() does not call any atfork
++   * handlers so the atfork handler that crashes will be skipped.  */
++#else /*HAVE_MACOS_SYSTEM*/
+   if ((pid = fork ()) == 0)
+   {
++#endif /*HAVE_MACOS_SYSTEM*/
+ /* Child.  */
+   int max_fds = -1;
+   int fd;
+@@ -664,6 +716,9 @@
+   close (fd);
+   }
+ 
++#if HAVE_MACOS_SYSTEM
++_exit(posix_spawn(NULL, path, NULL, NULL, argv, environ));
++#else /*HAVE_MACOS_SYSTEM*/
+ execv (path, (char *const *) argv);
+ /* Hmm: in that case we could write a special status code to the
+status-pipe.  */
+@@ -674,6 +729,7 @@
+   _exit (1);
+   else
+   _exit (0);
++#endif /*HAVE_MACOS_SYSTEM*/
+ }
+ 
+   TRACE_LOG  ("waiting for child process pid=%i", pid);


core.git: include/svtools include/vcl sc/source svtools/source vcl/source vcl/unx

2024-03-21 Thread Patrick Luby (via logerrit)
 include/svtools/scrolladaptor.hxx|2 +
 include/vcl/toolkit/scrbar.hxx   |3 ++
 include/vcl/weld.hxx |1 
 sc/source/ui/inc/tabview.hxx |2 -
 sc/source/ui/view/tabview.cxx|   22 +--
 sc/source/ui/view/tabview4.cxx   |   45 +--
 svtools/source/control/scrolladaptor.cxx |2 +
 vcl/source/app/salvtables.cxx|2 +
 vcl/source/control/scrbar.cxx|6 ++--
 vcl/unx/gtk3/gtkinst.cxx |5 +++
 10 files changed, 76 insertions(+), 14 deletions(-)

New commits:
commit fbe350cb9f35039f8b10f8ac9aba6737cb5d84be
Author: Patrick Luby 
AuthorDate: Sun Mar 17 19:04:21 2024 -0400
Commit: Patrick Luby 
CommitDate: Thu Mar 21 11:45:08 2024 +0100

tdf#93352 Fix horizontal swiping and scrolling when using an RTL UI

Starting with commit bfa21ce5fa08f2c634ccb6162914be55aef9f3c2,
horizontal swiping in Calc moved in the wrong direction scrollbars
were drawn mirrored.

So, revert parts of commit bfa21ce5fa08f2c634ccb6162914be55aef9f3c2
so that we are using Calc's previous "negative scrollbar range"
implementation for RTL UIs, but only for horizontal scrollbars since
vertical scrollbars are the same in LTR and RTL UIs.

Also, always disable RTL for scrollbars. Enabling RTL causes the
following bugs when clicking or dragging the mouse in scrollbars in
Calc's RTL UI:
- Click or drag events get mirrored so you must click or drag in
  unexpected locations to move the scrollbar thumb in the desired
  direction
- Repeatedly dragging the scrollbar thumb leftward can only move
  no highter than the R, S, or T columns

Note: even though RTL is always disabled for Calc scrollbars, the arrows
must still be swapped in vcl's ScrollBar class.

Change-Id: I85aac94ffaf7df2eeb251a3ff150cc0363b5d770
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164959
Reviewed-by: Stéphane Guillou 
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/include/svtools/scrolladaptor.hxx 
b/include/svtools/scrolladaptor.hxx
index cdc507078cf8..1eba1dfdf844 100644
--- a/include/svtools/scrolladaptor.hxx
+++ b/include/svtools/scrolladaptor.hxx
@@ -71,6 +71,8 @@ public:
 
 void SetThickness(int nThickness);
 
+void SetSwapArrows(bool bSwap = true);
+
 ScrollAdaptor(vcl::Window* pParent, bool bHori);
 virtual void dispose() override;
 };
diff --git a/include/vcl/toolkit/scrbar.hxx b/include/vcl/toolkit/scrbar.hxx
index 408ca90d7483..e8b9d37584ed 100644
--- a/include/vcl/toolkit/scrbar.hxx
+++ b/include/vcl/toolkit/scrbar.hxx
@@ -58,6 +58,7 @@ private:
 ScrollType  meScrollType;
 boolmbCalcSize;
 boolmbFullDrag;
+boolmbSwapArrows;
 Link   maScrollHdl;
 Link   maEndScrollHdl;
 
@@ -133,6 +134,8 @@ public:
 voidSetEndScrollHdl( const Link& rLink ) { 
maEndScrollHdl = rLink; }
 
 virtual SizeGetOptimalSize() const override;
+
+voidSetSwapArrows( bool bSwap ) { mbSwapArrows = bSwap; }
 };
 
 
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index c93524e3bfd4..8b9495e9e4e8 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2576,6 +2576,7 @@ public:
 
 virtual int get_scroll_thickness() const = 0;
 virtual void set_scroll_thickness(int nThickness) = 0;
+virtual void set_scroll_swap_arrows(bool bSwap) = 0;
 
 virtual ScrollType get_scroll_type() const = 0;
 
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 2bf71e00eea1..1873a525e9dd 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -242,7 +242,7 @@ private:
 voidUpdateVarZoom();
 
 static void SetScrollBar( ScrollAdaptor& rScroll, tools::Long 
nRangeMax, tools::Long nVisible, tools::Long nPos, bool bLayoutRTL );
-static tools::Long GetScrollBarPos( const ScrollAdaptor& rScroll );
+static tools::Long GetScrollBarPos( const ScrollAdaptor& rScroll, bool 
bLayoutRTL );
 
 voidGetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, 
ScFollowMode eMode,
SCCOL& rAreaX, SCROW& rAreaY, 
ScFollowMode& rMode,
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index a8a3642df240..e809ceb11249 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1097,7 +1097,7 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll)
 nViewPos = aViewData.GetPosY( (pScroll == aVScrollTop.get()) ?
 SC_SPLIT_TOP : SC_SPLIT_BOTTOM );
 
-bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( 
aViewData.GetTabNo() );
+bool bLayoutRTL = bHoriz && aViewData.GetDocument().IsLayoutRTL( 
aViewData.GetTabNo() );
 
 ScrollType eType = 

core.git: Branch 'libreoffice-24-2-2' - external/skia

2024-03-17 Thread Patrick Luby (via logerrit)
 external/skia/Library_skia.mk |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 0ffcf99d3e05cf6405d3aa5fbea281a6b5632c9a
Author: Patrick Luby 
AuthorDate: Sat Mar 16 14:46:29 2024 -0400
Commit: Patrick Luby 
CommitDate: Sun Mar 17 12:25:57 2024 +0100

tdf#160036 Enable SKSL when using Skia/Raster

Starting with the upgrade of Skia from m111 to m116, SKSL is disabled
by default for Skia/Raster so define SK_RASTER_PIPELINE_OPS_ALL to
enable it.

Change-Id: Ibd10efa0540f1e87123c341b529c8e3931e1a8fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164933
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 22dbaf45fb378107ad7daa0d7894939d6e0c7ee3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164877
Reviewed-by: Adolfo Jayme Barrientos 
Reviewed-by: Noel Grandin 
Tested-by: Patrick Luby 

diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk
index c2163d299327..55af14cd2daf 100644
--- a/external/skia/Library_skia.mk
+++ b/external/skia/Library_skia.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_Library_add_defs,skia,\
 -DSK_USER_CONFIG_HEADER="<$(BUILDDIR)/config_host/config_skia.h>" \
 $(if $(filter INTEL,$(CPUNAME)),$(if $(filter 
WNT,$(OS)),-DSK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE1,-DSK_CPU_SSE_LEVEL=0)) \
 $(if $(filter X86_64,$(CPUNAME)),-DSK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2) 
\
+-DSK_ENABLE_SKSL_IN_RASTER_PIPELINE \
 ))
 
 # SK_DEBUG controls runtime checks and is controlled by config_skia.h and 
depends on DBG_UTIL.
@@ -565,6 +566,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,skia,\
 UnpackedTarball/skia/src/sksl/analysis/SkSLReturnsInputAlpha \
 UnpackedTarball/skia/src/sksl/analysis/SkSLSymbolTableStackBuilder \
 UnpackedTarball/skia/src/sksl/analysis/SkSLSwitchCaseContainsExit \
+UnpackedTarball/skia/src/sksl/analysis/SkSLGetLoopControlFlowInfo \
+UnpackedTarball/skia/src/sksl/analysis/SkSLIsDynamicallyUniformExpression \
 UnpackedTarball/skia/src/sksl/codegen/SkSLGLSLCodeGenerator \
 UnpackedTarball/skia/src/sksl/codegen/SkSLMetalCodeGenerator \
 UnpackedTarball/skia/src/sksl/codegen/SkSLPipelineStageCodeGenerator \
@@ -572,6 +575,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,skia,\
 UnpackedTarball/skia/src/sksl/codegen/SkSLSPIRVtoHLSL \
 UnpackedTarball/skia/src/sksl/codegen/SkSLVMCodeGenerator \
 UnpackedTarball/skia/src/sksl/codegen/SkSLWGSLCodeGenerator \
+UnpackedTarball/skia/src/sksl/codegen/SkSLRasterPipelineBuilder \
+UnpackedTarball/skia/src/sksl/codegen/SkSLRasterPipelineCodeGenerator \
 UnpackedTarball/skia/src/sksl/transform/SkSLAddConstToVarModifiers \
 UnpackedTarball/skia/src/sksl/transform/SkSLEliminateDeadFunctions \
 UnpackedTarball/skia/src/sksl/transform/SkSLEliminateDeadGlobalVariables \


core.git: Branch 'libreoffice-24-2' - external/skia

2024-03-17 Thread Patrick Luby (via logerrit)
 external/skia/Library_skia.mk |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 0696fa0845feaab96a90dfdce96131998961b50a
Author: Patrick Luby 
AuthorDate: Sat Mar 16 14:46:29 2024 -0400
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Mar 17 07:09:04 2024 +0100

tdf#160036 Enable SKSL when using Skia/Raster

Starting with the upgrade of Skia from m111 to m116, SKSL is disabled
by default for Skia/Raster so define SK_RASTER_PIPELINE_OPS_ALL to
enable it.

Change-Id: Ibd10efa0540f1e87123c341b529c8e3931e1a8fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164933
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 22dbaf45fb378107ad7daa0d7894939d6e0c7ee3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164876
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk
index c2163d299327..55af14cd2daf 100644
--- a/external/skia/Library_skia.mk
+++ b/external/skia/Library_skia.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_Library_add_defs,skia,\
 -DSK_USER_CONFIG_HEADER="<$(BUILDDIR)/config_host/config_skia.h>" \
 $(if $(filter INTEL,$(CPUNAME)),$(if $(filter 
WNT,$(OS)),-DSK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE1,-DSK_CPU_SSE_LEVEL=0)) \
 $(if $(filter X86_64,$(CPUNAME)),-DSK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2) 
\
+-DSK_ENABLE_SKSL_IN_RASTER_PIPELINE \
 ))
 
 # SK_DEBUG controls runtime checks and is controlled by config_skia.h and 
depends on DBG_UTIL.
@@ -565,6 +566,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,skia,\
 UnpackedTarball/skia/src/sksl/analysis/SkSLReturnsInputAlpha \
 UnpackedTarball/skia/src/sksl/analysis/SkSLSymbolTableStackBuilder \
 UnpackedTarball/skia/src/sksl/analysis/SkSLSwitchCaseContainsExit \
+UnpackedTarball/skia/src/sksl/analysis/SkSLGetLoopControlFlowInfo \
+UnpackedTarball/skia/src/sksl/analysis/SkSLIsDynamicallyUniformExpression \
 UnpackedTarball/skia/src/sksl/codegen/SkSLGLSLCodeGenerator \
 UnpackedTarball/skia/src/sksl/codegen/SkSLMetalCodeGenerator \
 UnpackedTarball/skia/src/sksl/codegen/SkSLPipelineStageCodeGenerator \
@@ -572,6 +575,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,skia,\
 UnpackedTarball/skia/src/sksl/codegen/SkSLSPIRVtoHLSL \
 UnpackedTarball/skia/src/sksl/codegen/SkSLVMCodeGenerator \
 UnpackedTarball/skia/src/sksl/codegen/SkSLWGSLCodeGenerator \
+UnpackedTarball/skia/src/sksl/codegen/SkSLRasterPipelineBuilder \
+UnpackedTarball/skia/src/sksl/codegen/SkSLRasterPipelineCodeGenerator \
 UnpackedTarball/skia/src/sksl/transform/SkSLAddConstToVarModifiers \
 UnpackedTarball/skia/src/sksl/transform/SkSLEliminateDeadFunctions \
 UnpackedTarball/skia/src/sksl/transform/SkSLEliminateDeadGlobalVariables \


core.git: external/skia sw/qa vcl/qa

2024-03-16 Thread Patrick Luby (via logerrit)
 external/skia/Library_skia.mk  |5 +
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |5 -
 vcl/qa/cppunit/BackendTest.cxx |4 
 3 files changed, 5 insertions(+), 9 deletions(-)

New commits:
commit 39663a323c3330c18b610fcdc9e9c75ddac770f1
Author: Patrick Luby 
AuthorDate: Sat Mar 16 14:46:29 2024 -0400
Commit: Patrick Luby 
CommitDate: Sat Mar 16 23:23:18 2024 +0100

tdf#160036 Enable SKSL when using Skia/Raster

Starting with the upgrade of Skia from m111 to m116, SKSL is disabled
by default for Skia/Raster so define SK_RASTER_PIPELINE_OPS_ALL to
enable it.

Also, reenable XOR drawing unit tests that were previously failing.

Change-Id: Ibd10efa0540f1e87123c341b529c8e3931e1a8fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164933
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk
index c2163d299327..55af14cd2daf 100644
--- a/external/skia/Library_skia.mk
+++ b/external/skia/Library_skia.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_Library_add_defs,skia,\
 -DSK_USER_CONFIG_HEADER="<$(BUILDDIR)/config_host/config_skia.h>" \
 $(if $(filter INTEL,$(CPUNAME)),$(if $(filter 
WNT,$(OS)),-DSK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE1,-DSK_CPU_SSE_LEVEL=0)) \
 $(if $(filter X86_64,$(CPUNAME)),-DSK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2) 
\
+-DSK_ENABLE_SKSL_IN_RASTER_PIPELINE \
 ))
 
 # SK_DEBUG controls runtime checks and is controlled by config_skia.h and 
depends on DBG_UTIL.
@@ -565,6 +566,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,skia,\
 UnpackedTarball/skia/src/sksl/analysis/SkSLReturnsInputAlpha \
 UnpackedTarball/skia/src/sksl/analysis/SkSLSymbolTableStackBuilder \
 UnpackedTarball/skia/src/sksl/analysis/SkSLSwitchCaseContainsExit \
+UnpackedTarball/skia/src/sksl/analysis/SkSLGetLoopControlFlowInfo \
+UnpackedTarball/skia/src/sksl/analysis/SkSLIsDynamicallyUniformExpression \
 UnpackedTarball/skia/src/sksl/codegen/SkSLGLSLCodeGenerator \
 UnpackedTarball/skia/src/sksl/codegen/SkSLMetalCodeGenerator \
 UnpackedTarball/skia/src/sksl/codegen/SkSLPipelineStageCodeGenerator \
@@ -572,6 +575,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,skia,\
 UnpackedTarball/skia/src/sksl/codegen/SkSLSPIRVtoHLSL \
 UnpackedTarball/skia/src/sksl/codegen/SkSLVMCodeGenerator \
 UnpackedTarball/skia/src/sksl/codegen/SkSLWGSLCodeGenerator \
+UnpackedTarball/skia/src/sksl/codegen/SkSLRasterPipelineBuilder \
+UnpackedTarball/skia/src/sksl/codegen/SkSLRasterPipelineCodeGenerator \
 UnpackedTarball/skia/src/sksl/transform/SkSLAddConstToVarModifiers \
 UnpackedTarball/skia/src/sksl/transform/SkSLEliminateDeadFunctions \
 UnpackedTarball/skia/src/sksl/transform/SkSLEliminateDeadGlobalVariables \
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index febcec916aae..2ac490d61a14 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 class Test : public SwModelTestBase
@@ -765,10 +764,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf136841, "tdf136841.docx")
 CPPUNIT_ASSERT_EQUAL( tools::Long(76), bitmap.GetSizePixel().Width());
 CPPUNIT_ASSERT_EQUAL( tools::Long(76), bitmap.GetSizePixel().Height());
 
-// FIXME this still has some issues with skia
-if (SkiaHelper::isVCLSkiaEnabled())
-return;
-
 // Without the fix in place, this test would have failed with
 // - Expected: Color: R:228 G:71 B:69 A:0
 // - Actual  : Color: R:0 G:0 B:0 A:0
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index a90a96e3110e..a5b1a158ecc4 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -626,9 +625,6 @@ public:
 {
 if (getDefaultDeviceBitCount() < 24)
 return;
-// FIXME this still has some issues with skia
-if (SkiaHelper::isVCLSkiaEnabled())
-return;
 vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
 Bitmap aBitmap = aOutDevTest.setupXOR();
 auto eResult = 
vcl::test::OutputDeviceTestAnotherOutDev::checkXOR(aBitmap);


core.git: Branch 'libreoffice-24-2-2' - vcl/source

2024-03-08 Thread Patrick Luby (via logerrit)
 vcl/source/window/paint.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c4d42d7ffca8c8e1bfc6d23d5ca3b7553be5e78e
Author: Patrick Luby 
AuthorDate: Thu Mar 7 17:22:35 2024 -0500
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Mar 9 07:31:00 2024 +0100

tdf#159996 use transparent alpha mask for output device

Since commit 81994cb2b8b32453a92bcb011830fcb884f22ff3, fixed text
needs to be drawn to an output device with a transparent alpha
mask.

Change-Id: I2036e8c6c9133b1caceb24aeca40f04524c16b23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164556
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 73c14fcf97a1dcc9c95c98f9223449957b0b4963)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164500
Reviewed-by: Noel Grandin 
Tested-by: Adolfo Jayme Barrientos 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index a98703ca255b..deb4bc33 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1523,7 +1523,7 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
 VclPtrInstance pMaskedDevice(*i_pTargetOutDev,
 DeviceFormat::WITH_ALPHA);
 
-pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
+pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel(), true, true );
 pMaskedDevice->EnableRTL( IsRTLEnabled() );
 aMtf.WindStart();
 aMtf.Play(*pMaskedDevice);


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-03-07 Thread Patrick Luby (via logerrit)
 vcl/source/window/paint.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 358eee88dd0af37ffc83c3abd9633593b758a5be
Author: Patrick Luby 
AuthorDate: Thu Mar 7 17:22:35 2024 -0500
Commit: Noel Grandin 
CommitDate: Fri Mar 8 07:05:50 2024 +0100

tdf#159996 use transparent alpha mask for output device

Since commit 81994cb2b8b32453a92bcb011830fcb884f22ff3, fixed text
needs to be drawn to an output device with a transparent alpha
mask.

Change-Id: I2036e8c6c9133b1caceb24aeca40f04524c16b23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164556
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 73c14fcf97a1dcc9c95c98f9223449957b0b4963)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164499
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index a98703ca255b..deb4bc33 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1523,7 +1523,7 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
 VclPtrInstance pMaskedDevice(*i_pTargetOutDev,
 DeviceFormat::WITH_ALPHA);
 
-pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
+pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel(), true, true );
 pMaskedDevice->EnableRTL( IsRTLEnabled() );
 aMtf.WindStart();
 aMtf.Play(*pMaskedDevice);


core.git: vcl/source

2024-03-07 Thread Patrick Luby (via logerrit)
 vcl/source/window/paint.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ff113b34dd6f54765995440cbedd27483fadb844
Author: Patrick Luby 
AuthorDate: Thu Mar 7 17:22:35 2024 -0500
Commit: Patrick Luby 
CommitDate: Fri Mar 8 00:57:20 2024 +0100

tdf#159996 use transparent alpha mask for output device

Since commit 81994cb2b8b32453a92bcb011830fcb884f22ff3, fixed text
needs to be drawn to an output device with a transparent alpha
mask.

Change-Id: I2036e8c6c9133b1caceb24aeca40f04524c16b23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164556
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 7cb1c969a983..5996b818d4bb 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1528,7 +1528,7 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
 VclPtrInstance pMaskedDevice(*i_pTargetOutDev,
 DeviceFormat::WITH_ALPHA);
 
-pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
+pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel(), true, true );
 pMaskedDevice->EnableRTL( IsRTLEnabled() );
 aMtf.WindStart();
 aMtf.Play(*pMaskedDevice);


core.git: xmlsecurity/inc xmlsecurity/source

2024-03-05 Thread Patrick Luby (via logerrit)
 xmlsecurity/inc/certificatechooser.hxx |   12 +++---
 xmlsecurity/source/component/documentdigitalsignatures.cxx |   14 +++
 xmlsecurity/source/dialogs/certificatechooser.cxx  |   26 ++---
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |2 -
 4 files changed, 27 insertions(+), 27 deletions(-)

New commits:
commit ce8d6b6836744045264eda41bcfdc4571c8b1b26
Author: Patrick Luby 
AuthorDate: Mon Mar 4 19:15:00 2024 -0500
Commit: Noel Grandin 
CommitDate: Tue Mar 5 18:35:14 2024 +0100

Related: tdf#152524 eliminate UserData struct name collision

The cui module has its own UserData struct and when building with
--enable-mergelibs=more, this data collision will cause a crash
when deleting a UserData instance in the xmlsecurity module because
the cui module already has its own, unrelated UserData struct.

Change-Id: I6418b049c72a2e902c9b5076b72fd240f65a593d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164404
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/inc/certificatechooser.hxx 
b/xmlsecurity/inc/certificatechooser.hxx
index b0cf7c7cdcc4..ef81678ffcc0 100644
--- a/xmlsecurity/inc/certificatechooser.hxx
+++ b/xmlsecurity/inc/certificatechooser.hxx
@@ -34,14 +34,14 @@ namespace com::sun::star {
 
 namespace com::sun::star::xml::crypto { class XXMLSecurityContext; }
 
-struct UserData
+struct CertificateChooserUserData
 {
 css::uno::Reference xCertificate;
 css::uno::Reference 
xSecurityContext;
 css::uno::Reference 
xSecurityEnvironment;
 };
 
-enum class UserAction
+enum class CertificateChooserUserAction
 {
 Sign,
 SelectSign, // Select signing certificate
@@ -52,10 +52,10 @@ class CertificateChooser final : public 
weld::GenericDialogController
 {
 private:
 std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > 
> mxSecurityContexts;
-std::vector> mvUserData;
+std::vector> mvUserData;
 
 boolmbInitialized;
-UserAction constmeAction;
+CertificateChooserUserAction const meAction;
 OUStringmsPreferredKey;
 css::uno::Reference mxEncryptToSelf;
 
@@ -86,12 +86,12 @@ private:
 public:
 CertificateChooser(weld::Window* pParent,
std::vector< css::uno::Reference< 
css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts,
-   UserAction eAction);
+   CertificateChooserUserAction eAction);
 virtual ~CertificateChooser() override;
 
 static std::unique_ptr getInstance(weld::Window* 
_pParent,
 std::vector< css::uno::Reference< 
css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts,
-UserAction eAction) {
+CertificateChooserUserAction eAction) {
 // Don't reuse CertificateChooser instances
 // Reusing the same instance will, in the following case, lead to a
 // crash. It appears that the CertificateChooser is getting disposed
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx 
b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index c1768c0e953a..a06fcc81d128 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -103,7 +103,7 @@ private:
  DocumentSignatureMode eMode);
 
 css::uno::Sequence>
-chooseCertificatesImpl(std::map& rProperties, const 
UserAction eAction,
+chooseCertificatesImpl(std::map& rProperties, const 
CertificateChooserUserAction eAction,
const CertificateKind 
certificateKind=CertificateKind_NONE);
 
 bool
@@ -696,7 +696,7 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
 
 uno::Sequence>
 DocumentDigitalSignatures::chooseCertificatesImpl(std::map& rProperties,
-  const UserAction eAction,
+  const 
CertificateChooserUserAction eAction,
   const CertificateKind 
certificateKind)
 {
 std::vector< Reference< css::xml::crypto::XXMLSecurityContext > > 
xSecContexts;
@@ -729,7 +729,7 @@ Reference< css::security::XCertificate > 
DocumentDigitalSignatures::chooseCertif
 Reference< css::security::XCertificate > 
DocumentDigitalSignatures::chooseSigningCertificate(OUString& rDescription)
 {
 std::map aProperties;
-Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( 
aProperties, UserAction::Sign )[0];
+Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( 
aProperties, CertificateChooserUserAction::Sign )[0];
 rDescription = aProperties["Description"];
 return xCert;
 }
@@ -737,7 +737,7 @@ Reference< css::security::XCertificate > 
DocumentDigitalSignatures::chooseSignin
 Reference< 

core.git: Branch 'libreoffice-24-2' - drawinglayer/inc drawinglayer/source

2024-03-04 Thread Patrick Luby (via logerrit)
 drawinglayer/inc/texture/texture3d.hxx|2 +-
 drawinglayer/source/texture/texture3d.cxx |   12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 30862f999acc54e2690d28f97b95764f664c1f5a
Author: Patrick Luby 
AuthorDate: Sun Mar 3 19:34:09 2024 -0500
Commit: Patrick Luby 
CommitDate: Mon Mar 4 15:41:41 2024 +0100

tdf#159515 rename impGetTransparence() to impGetAlpha()

Commit 81994cb2b8b32453a92bcb011830fcb884f22ff3 makes
impGetTransparence() return alpha instead of transparence. So,
rename the function and skip reverting the result to obtain the
alpha value.

Change-Id: Ied3bf8ae4a0de2ae36074dba9f78ccc93480b15a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164322
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
Tested-by: Patrick Luby 
(cherry picked from commit b4caea04cb63cbdc25bab871a5b20aa16e2f3a77)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164371
Tested-by: Jenkins

diff --git a/drawinglayer/inc/texture/texture3d.hxx 
b/drawinglayer/inc/texture/texture3d.hxx
index 07f4b181b2ad..1ec4df70734c 100644
--- a/drawinglayer/inc/texture/texture3d.hxx
+++ b/drawinglayer/inc/texture/texture3d.hxx
@@ -66,7 +66,7 @@ namespace drawinglayer::texture
 
 // helpers
 bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, 
sal_Int32& rY) const;
-sal_uInt8 impGetTransparence(sal_Int32 rX, sal_Int32 rY) const;
+sal_uInt8 impGetAlpha(sal_Int32 rX, sal_Int32 rY) const;
 
 public:
 GeoTexSvxBitmapEx(
diff --git a/drawinglayer/source/texture/texture3d.cxx 
b/drawinglayer/source/texture/texture3d.cxx
index 3ee751cbbda4..4cbcab9d1c5d 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -103,7 +103,7 @@ namespace drawinglayer::texture
 {
 }
 
-sal_uInt8 GeoTexSvxBitmapEx::impGetTransparence(sal_Int32 rX, 
sal_Int32 rY) const
+sal_uInt8 GeoTexSvxBitmapEx::impGetAlpha(sal_Int32 rX, sal_Int32 rY) 
const
 {
 if(mbIsAlpha)
 {
@@ -148,10 +148,10 @@ namespace drawinglayer::texture
 
 if(mbIsAlpha)
 {
-// when we have a transparence, make use of it
-const sal_uInt8 aLuminance(impGetTransparence(nX, nY));
+// when we have alpha, make use of it
+const sal_uInt8 aAlpha(impGetAlpha(nX, nY));
 
-rfOpacity = (static_cast(0xff - aLuminance) * (1.0 
/ 255.0));
+rfOpacity = (static_cast(aAlpha) * (1.0 / 255.0));
 }
 else
 {
@@ -173,8 +173,8 @@ namespace drawinglayer::texture
 if(mbIsAlpha)
 {
 // this texture has an alpha part, use it
-const sal_uInt8 aLuminance(impGetTransparence(nX, nY));
-const double fNewOpacity(static_cast(0xff - 
aLuminance) * (1.0 / 255.0));
+const sal_uInt8 aAlpha(impGetAlpha(nX, nY));
+const double fNewOpacity(static_cast(aAlpha) * 
(1.0 / 255.0));
 
 rfOpacity = 1.0 - ((1.0 - fNewOpacity) * (1.0 - 
rfOpacity));
 }


core.git: drawinglayer/inc drawinglayer/source

2024-03-04 Thread Patrick Luby (via logerrit)
 drawinglayer/inc/texture/texture3d.hxx|2 +-
 drawinglayer/source/texture/texture3d.cxx |   12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 86c3105fdb6b67fcc65e76077785b745871151b6
Author: Patrick Luby 
AuthorDate: Sun Mar 3 19:34:09 2024 -0500
Commit: Patrick Luby 
CommitDate: Mon Mar 4 13:27:46 2024 +0100

tdf#159515 rename impGetTransparence() to impGetAlpha()

Commit 81994cb2b8b32453a92bcb011830fcb884f22ff3 makes
impGetTransparence() return alpha instead of transparence. So,
rename the function and skip reverting the result to obtain the
alpha value.

Change-Id: Ied3bf8ae4a0de2ae36074dba9f78ccc93480b15a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164322
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
Tested-by: Patrick Luby 

diff --git a/drawinglayer/inc/texture/texture3d.hxx 
b/drawinglayer/inc/texture/texture3d.hxx
index 07f4b181b2ad..1ec4df70734c 100644
--- a/drawinglayer/inc/texture/texture3d.hxx
+++ b/drawinglayer/inc/texture/texture3d.hxx
@@ -66,7 +66,7 @@ namespace drawinglayer::texture
 
 // helpers
 bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, 
sal_Int32& rY) const;
-sal_uInt8 impGetTransparence(sal_Int32 rX, sal_Int32 rY) const;
+sal_uInt8 impGetAlpha(sal_Int32 rX, sal_Int32 rY) const;
 
 public:
 GeoTexSvxBitmapEx(
diff --git a/drawinglayer/source/texture/texture3d.cxx 
b/drawinglayer/source/texture/texture3d.cxx
index 3ee751cbbda4..4cbcab9d1c5d 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -103,7 +103,7 @@ namespace drawinglayer::texture
 {
 }
 
-sal_uInt8 GeoTexSvxBitmapEx::impGetTransparence(sal_Int32 rX, 
sal_Int32 rY) const
+sal_uInt8 GeoTexSvxBitmapEx::impGetAlpha(sal_Int32 rX, sal_Int32 rY) 
const
 {
 if(mbIsAlpha)
 {
@@ -148,10 +148,10 @@ namespace drawinglayer::texture
 
 if(mbIsAlpha)
 {
-// when we have a transparence, make use of it
-const sal_uInt8 aLuminance(impGetTransparence(nX, nY));
+// when we have alpha, make use of it
+const sal_uInt8 aAlpha(impGetAlpha(nX, nY));
 
-rfOpacity = (static_cast(0xff - aLuminance) * (1.0 
/ 255.0));
+rfOpacity = (static_cast(aAlpha) * (1.0 / 255.0));
 }
 else
 {
@@ -173,8 +173,8 @@ namespace drawinglayer::texture
 if(mbIsAlpha)
 {
 // this texture has an alpha part, use it
-const sal_uInt8 aLuminance(impGetTransparence(nX, nY));
-const double fNewOpacity(static_cast(0xff - 
aLuminance) * (1.0 / 255.0));
+const sal_uInt8 aAlpha(impGetAlpha(nX, nY));
+const double fNewOpacity(static_cast(aAlpha) * 
(1.0 / 255.0));
 
 rfOpacity = 1.0 - ((1.0 - fNewOpacity) * (1.0 - 
rfOpacity));
 }


core.git: vcl/skia

2024-02-24 Thread Patrick Luby (via logerrit)
 vcl/skia/osx/gdiimpl.cxx |   21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 3e2dde97bc15f156837d10bf4456deb81f7f554a
Author: Patrick Luby 
AuthorDate: Thu Feb 22 10:01:00 2024 -0500
Commit: Patrick Luby 
CommitDate: Sat Feb 24 15:13:47 2024 +0100

Related: tdf#159529 eliminate possible memory leak

Despite confirming that the release function passed to
SkBitmap.bitmap.installPixels() does get called for every
data array that has been allocated, Apple's Instruments
indicates that the data is leaking. While it is likely a
false positive, it makes leak analysis difficult so leave
the bitmap mutable. That causes SkBitmap.asImage() to make
a copy of the data and the data can be safely deleted here.

Change-Id: Ib28d70bd5f51e6d3be7a7d7c0d5923d71a6e5390
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163774
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx
index c4bd75184242..9b511ad4469b 100644
--- a/vcl/skia/osx/gdiimpl.cxx
+++ b/vcl/skia/osx/gdiimpl.cxx
@@ -37,12 +37,6 @@
 
 using namespace SkiaHelper;
 
-static void releaseInstalledPixels(void* pAddr, void*)
-{
-if (pAddr)
-delete[] static_cast(pAddr);
-}
-
 AquaSkiaSalGraphicsImpl::AquaSkiaSalGraphicsImpl(AquaSalGraphics& rParent,
  AquaSharedAttributes& rShared)
 : SkiaSalGraphicsImpl(rParent, rShared.mpFrame)
@@ -251,6 +245,7 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType 
nType, ControlPart n
 if (!context)
 {
 SAL_WARN("vcl.skia", "drawNativeControl(): Failed to allocate bitmap 
context");
+delete[] data;
 return false;
 }
 // Setup context state for drawing (performDrawNativeControl() e.g. fills 
background in some cases).
@@ -287,12 +282,9 @@ bool 
AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n
 if (!bitmap.installPixels(SkImageInfo::Make(width, height,
 
mSurface->imageInfo().colorType(),
 kPremul_SkAlphaType),
-  data, width * 4, releaseInstalledPixels, 
nullptr))
+  data, width * 4, nullptr, nullptr))
 abort();
 
-// Make bitmap immutable to avoid making a copy in bitmap.asImage()
-bitmap.setImmutable();
-
 preDraw();
 SAL_INFO("vcl.skia.trace", "drawnativecontrol(" << this << "): " << 
rControlRegion << ":"
 << int(nType) << "/" 
<< int(nPart));
@@ -312,6 +304,15 @@ bool 
AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n
 ++pendingOperationsToFlush; // tdf#136369
 postDraw();
 }
+// Related: tdf#159529 eliminate possible memory leak
+// Despite confirming that the release function passed to
+// SkBitmap.bitmap.installPixels() does get called for every
+// data array that has been allocated, Apple's Instruments
+//  indicates that the data is leaking. While it is likely a
+// false positive, it makes leak analysis difficult so leave
+// the bitmap mutable. That causes SkBitmap.asImage() to make
+// a copy of the data and the data can be safely deleted here.
+delete[] data;
 return bOK;
 }
 


core.git: vcl/osx

2024-02-23 Thread Patrick Luby (via logerrit)
 vcl/osx/salframeview.mm |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit ef57aeb9ed190e18ebc034b9a45e190aea3f8f1d
Author: Patrick Luby 
AuthorDate: Fri Feb 23 17:45:19 2024 -0500
Commit: Patrick Luby 
CommitDate: Sat Feb 24 02:09:42 2024 +0100

tdf#158124 KEY_DELETE events do not need an ExtTextInput event

When using various Japanese input methods, the last event will be a
repeating key down event with a single delete character while the
Backspace key, Delete key, or Fn-Delete keys are pressed. These key
events are now ignored since setting mbTextInputWantsNonRepeatKeyDown
to YES for these events will trigger an assert or crash when saving a
.docx document.

Change-Id: If3762fcf41aa82bf4aa5dc7d1f15c1d282c86f99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163875
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index 995eeb574999..dba377899838 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -2062,7 +2062,15 @@ static void updateWinDataInLiveResize(bool bInLiveResize)
 // and then dispatch a SalEvent::EndExtTextInput event.
 NSString *pNewMarkedText = nullptr;
 NSString *pChars = [mpLastEvent characters];
-bool bNeedsExtTextInput = ( pChars && mbInKeyInput && !mpLastMarkedText && 
mpLastEvent && [mpLastEvent type] == NSEventTypeKeyDown && [mpLastEvent 
isARepeat] );
+
+// tdf#158124 KEY_DELETE events do not need an ExtTextInput event
+// When using various Japanese input methods, the last event will be a
+// repeating key down event with a single delete character while the
+// Backspace key, Delete key, or Fn-Delete keys are pressed. These key
+// events are now ignored since setting mbTextInputWantsNonRepeatKeyDown
+// to YES for these events will trigger an assert or crash when saving a
+// .docx document.
+bool bNeedsExtTextInput = ( pChars && mbInKeyInput && !mpLastMarkedText && 
mpLastEvent && [mpLastEvent type] == NSEventTypeKeyDown && [mpLastEvent 
isARepeat] && ImplMapKeyCode( [mpLastEvent keyCode] ) != KEY_DELETE );
 if ( bNeedsExtTextInput )
 {
 // tdf#154708 Preserve selection for repeating Shift-arrow on Japanese 
keyboard


core.git: external/gpgmepp

2024-02-22 Thread Patrick Luby (via logerrit)
 external/gpgmepp/macos-tdf152524.patch |   38 +++--
 1 file changed, 4 insertions(+), 34 deletions(-)

New commits:
commit 3b4a8977652b7e69469d0e56e12de50e07ceae2f
Author: Patrick Luby 
AuthorDate: Thu Feb 22 16:13:45 2024 +0100
Commit: Patrick Luby 
CommitDate: Fri Feb 23 00:08:02 2024 +0100

Revert "tdf#152524 use dispatch_async() instead of dispatch_sync()"

This reverts commit b0656e6ca668a0719fbcb71b6d46c68093dda470.

Reason for revert: This patch has not made any positive difference for 
tdf#152524.

Change-Id: I5ea0f80263188049f06623ac930b4dc7856dc53e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163758
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
index ad6fbf8fe9cb..a69fbd1cf139 100644
--- a/external/gpgmepp/macos-tdf152524.patch
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -1,18 +1,17 @@
 --- src/posix-io.c 2023-02-01 11:50:48
 +++ src/posix-io.c 2024-02-05 19:16:00
-@@ -62,6 +62,11 @@
+@@ -62,6 +62,10 @@
  # endif
  #endif
  #include 
 +
 +#if HAVE_MACOS_SYSTEM
 +#include 
-+#include 
 +#endif
  
  #include "util.h"
  #include "priv-io.h"
-@@ -517,12 +522,79 @@
+@@ -517,12 +521,50 @@
  }
  
  
@@ -39,47 +38,18 @@
 +   * run in a sequential queue in a non-main thread.  */
 +  static dispatch_queue_t queue = NULL;
 +  if (!queue)
-+  queue = dispatch_queue_create ("gpgmeppforkandexec",
++  queue = dispatch_queue_create ("gpgmepp",
 + DISPATCH_QUEUE_CONCURRENT);
 +  if (!queue)
 +  return -1;
 +
 +  __block int ret = -1;
-+  __block int done = false;
-+  __block pthread_mutex_t waitlock = PTHREAD_MUTEX_INITIALIZER;
-+  __block pthread_cond_t waitcond = PTHREAD_COND_INITIALIZER;
-+
-+  if (pthread_mutex_lock())
-+  return -1;
-+
-+  /* Use dispatch_async() to force the queue to run in a separate
-+   * thread.  */
-+  dispatch_async(queue, ^{
-+  if (pthread_mutex_lock())
-+  {
-+  done = true;
-+  pthread_cond_signal();
-+  return;
-+  }
-+
++  dispatch_sync(queue, ^{
 +  ret = _gpgme_io_spawn_macos (path, argv, flags,
 +   fd_list, atfork,
 +   atforkvalue, r_pid);
-+
-+  done = true;
-+  pthread_cond_signal();
-+  pthread_mutex_unlock();
 +  });
 +
-+  /* dispatch_async_and_wait() doesn't necessarily force the queue
-+   * to run in a separate thread so block and until the task has
-+   * finished.  */
-+  if (!done)
-+  pthread_cond_wait(, );
-+  pthread_cond_destroy();
-+  pthread_mutex_unlock();
-+  pthread_mutex_destroy();
-+
 +  return ret;
 +}
 +


core.git: Branch 'libreoffice-24-2-1' - external/harfbuzz

2024-02-22 Thread Patrick Luby (via logerrit)
 external/harfbuzz/UnpackedTarball_harfbuzz.mk |1 
 external/harfbuzz/tdf159529.patch.0   |   28 ++
 2 files changed, 29 insertions(+)

New commits:
commit e0fd2489d5dd4b8b2bd41f6e42cfe64817a578da
Author: Patrick Luby 
AuthorDate: Tue Feb 20 19:06:04 2024 -0500
Commit: Patrick Luby 
CommitDate: Thu Feb 22 19:51:19 2024 +0100

tdf#159529 clear hb_ot_face_t data after fetching 'sbix' and 'glyf' tables

The 'sbix' and 'glyf' tables can be very large for color emoji fonts
so clear any cached data in hb_ot_face_t after fetching that table's
extents.

Change-Id: Id5deda9114b7199a4194ff16879e5791acd1cd82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163674
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit af47a78e11d4819bb4b1ae1a1277babd10d815b7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163622
Reviewed-by: Xisco Fauli 
Reviewed-by: Ilmari Lauhakangas 
Reviewed-by: Patrick Luby 
Tested-by: Patrick Luby 

diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk 
b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
index 9bc9e326b426..71627725fae7 100644
--- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk
+++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
@@ -16,6 +16,7 @@ $(eval $(call 
gb_UnpackedTarball_update_autoconf_configs,harfbuzz))
 $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
 
 $(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
+external/harfbuzz/tdf159529.patch.0 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/harfbuzz/tdf159529.patch.0 
b/external/harfbuzz/tdf159529.patch.0
new file mode 100644
index ..d76313ce83be
--- /dev/null
+++ b/external/harfbuzz/tdf159529.patch.0
@@ -0,0 +1,28 @@
+--- ./src/hb-ot-font.cc2023-11-11 09:08:45
 ./src/hb-ot-font.cc2024-02-20 18:53:55
+@@ -428,13 +428,23 @@
+   const hb_ot_face_t *ot_face = ot_font->ot_face;
+ 
+ #if !defined(HB_NO_OT_FONT_BITMAP) && !defined(HB_NO_COLOR)
+-  if (ot_face->sbix->get_extents (font, glyph, extents)) return true;
++  /* tdf#159529 clear the hb_ot_face_t's data after fetching 'sbix' table
++   * The 'sbix' table can be very large for color emoji fonts so clear any
++   * cached data in hb_ot_face_t after fetching that table's extents. */
++  bool sbixResult = ot_face->sbix->get_extents (font, glyph, extents);
++  const_cast(ot_face)->sbix.fini ();
++  if (sbixResult) return true;
+   if (ot_face->CBDT->get_extents (font, glyph, extents)) return true;
+ #endif
+ #if !defined(HB_NO_COLOR) && !defined(HB_NO_PAINT)
+   if (ot_face->COLR->get_extents (font, glyph, extents)) return true;
+ #endif
+-  if (ot_face->glyf->get_extents (font, glyph, extents)) return true;
++  /* tdf#159529 clear the hb_ot_face_t's data after fetching 'glyf' table
++   * The 'glyf' table can be very large for color emoji fonts so clear any
++   * cached data in hb_ot_face_t after fetching that table's extents. */
++  bool glyfResult = ot_face->glyf->get_extents (font, glyph, extents);
++  const_cast(ot_face)->glyf.fini ();
++  if (glyfResult) return true;
+ #ifndef HB_NO_OT_FONT_CFF
+   if (ot_face->cff2->get_extents (font, glyph, extents)) return true;
+   if (ot_face->cff1->get_extents (font, glyph, extents)) return true;


core.git: Branch 'libreoffice-24-2' - external/harfbuzz

2024-02-22 Thread Patrick Luby (via logerrit)
 external/harfbuzz/UnpackedTarball_harfbuzz.mk |1 
 external/harfbuzz/tdf159529.patch.0   |   28 ++
 2 files changed, 29 insertions(+)

New commits:
commit 618e977e7f6973bf36bf83c04f7802cb83f8064a
Author: Patrick Luby 
AuthorDate: Tue Feb 20 19:06:04 2024 -0500
Commit: Xisco Fauli 
CommitDate: Thu Feb 22 17:53:31 2024 +0100

tdf#159529 clear hb_ot_face_t data after fetching 'sbix' and 'glyf' tables

The 'sbix' and 'glyf' tables can be very large for color emoji fonts
so clear any cached data in hb_ot_face_t after fetching that table's
extents.

Change-Id: Id5deda9114b7199a4194ff16879e5791acd1cd82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163674
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit af47a78e11d4819bb4b1ae1a1277babd10d815b7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163620
Reviewed-by: Patrick Luby 
Reviewed-by: Xisco Fauli 

diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk 
b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
index 9bc9e326b426..71627725fae7 100644
--- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk
+++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
@@ -16,6 +16,7 @@ $(eval $(call 
gb_UnpackedTarball_update_autoconf_configs,harfbuzz))
 $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
 
 $(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
+external/harfbuzz/tdf159529.patch.0 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/harfbuzz/tdf159529.patch.0 
b/external/harfbuzz/tdf159529.patch.0
new file mode 100644
index ..d76313ce83be
--- /dev/null
+++ b/external/harfbuzz/tdf159529.patch.0
@@ -0,0 +1,28 @@
+--- ./src/hb-ot-font.cc2023-11-11 09:08:45
 ./src/hb-ot-font.cc2024-02-20 18:53:55
+@@ -428,13 +428,23 @@
+   const hb_ot_face_t *ot_face = ot_font->ot_face;
+ 
+ #if !defined(HB_NO_OT_FONT_BITMAP) && !defined(HB_NO_COLOR)
+-  if (ot_face->sbix->get_extents (font, glyph, extents)) return true;
++  /* tdf#159529 clear the hb_ot_face_t's data after fetching 'sbix' table
++   * The 'sbix' table can be very large for color emoji fonts so clear any
++   * cached data in hb_ot_face_t after fetching that table's extents. */
++  bool sbixResult = ot_face->sbix->get_extents (font, glyph, extents);
++  const_cast(ot_face)->sbix.fini ();
++  if (sbixResult) return true;
+   if (ot_face->CBDT->get_extents (font, glyph, extents)) return true;
+ #endif
+ #if !defined(HB_NO_COLOR) && !defined(HB_NO_PAINT)
+   if (ot_face->COLR->get_extents (font, glyph, extents)) return true;
+ #endif
+-  if (ot_face->glyf->get_extents (font, glyph, extents)) return true;
++  /* tdf#159529 clear the hb_ot_face_t's data after fetching 'glyf' table
++   * The 'glyf' table can be very large for color emoji fonts so clear any
++   * cached data in hb_ot_face_t after fetching that table's extents. */
++  bool glyfResult = ot_face->glyf->get_extents (font, glyph, extents);
++  const_cast(ot_face)->glyf.fini ();
++  if (glyfResult) return true;
+ #ifndef HB_NO_OT_FONT_CFF
+   if (ot_face->cff2->get_extents (font, glyph, extents)) return true;
+   if (ot_face->cff1->get_extents (font, glyph, extents)) return true;


core.git: Branch 'distro/collabora/co-24.04' - 11 commits - oox/source sal/osl sc/source sfx2/uiconfig sw/inc sw/qa sw/source unotools/source vcl/inc vcl/osx writerfilter/source

2024-02-21 Thread Patrick Luby (via logerrit)
 oox/source/export/vmlexport.cxx   |7 
 sal/osl/unx/file.cxx  |   54 +++-
 sc/source/filter/rtf/rtfparse.cxx |4 
 sfx2/uiconfig/ui/panel.ui |3 
 sw/inc/crsrsh.hxx |4 
 sw/inc/ndarr.hxx  |9 
 sw/inc/node.hxx   |2 
 sw/qa/core/layout/data/floattable-wrapped-by-table-nested.docx|binary
 sw/qa/core/layout/tabfrm.cxx  |   14 +
 sw/qa/extras/layout/data/largeTopMarginAndHiddenFirstSection.fodt |   15 +
 sw/qa/extras/layout/data/pageBreakInHiddenSection.fodt|   90 
+++
 sw/qa/extras/layout/layout3.cxx   |   68 -
 sw/qa/extras/uiwriter/data/FrameInHiddenSection.fodt  |   20 +
 sw/qa/extras/uiwriter/data/hiddenSectionsAroundPageBreak.fodt |   21 +
 sw/qa/extras/uiwriter/uiwriter9.cxx   |   37 +++
 sw/source/core/crsr/crsrsh.cxx|   25 +-
 sw/source/core/crsr/pam.cxx   |5 
 sw/source/core/crsr/swcrsr.cxx|4 
 sw/source/core/doc/docedt.cxx |4 
 sw/source/core/docnode/ndsect.cxx |4 
 sw/source/core/docnode/nodes.cxx  |   58 +++-
 sw/source/core/docnode/section.cxx|7 
 sw/source/core/edit/editsh.cxx|2 
 sw/source/core/inc/frame.hxx  |2 
 sw/source/core/inc/sectfrm.hxx|2 
 sw/source/core/inc/txtfrm.hxx |2 
 sw/source/core/layout/calcmove.cxx|   13 -
 sw/source/core/layout/findfrm.cxx |8 
 sw/source/core/layout/flowfrm.cxx |  119 
--
 sw/source/core/layout/frmtool.cxx |   23 -
 sw/source/core/layout/ftnfrm.cxx  |   10 
 sw/source/core/layout/pagechg.cxx |5 
 sw/source/core/layout/sectfrm.cxx |   37 +++
 sw/source/core/layout/tabfrm.cxx  |   16 +
 sw/source/core/layout/trvlfrm.cxx |   25 +-
 sw/source/core/text/txtfrm.cxx|   19 -
 sw/source/ui/fldui/flddok.cxx |2 
 unotools/source/ucbhelper/tempfile.cxx|   91 
---
 vcl/inc/osx/salnsmenu.h   |   10 
 vcl/osx/salmenu.cxx   |   13 -
 vcl/osx/salnsmenu.mm  |   80 ++
 vcl/osx/vclnsapp.mm   |   49 
 writerfilter/source/dmapper/DomainMapper.cxx  |3 
 writerfilter/source/dmapper/PropertyIds.cxx   |1 
 writerfilter/source/dmapper/PropertyIds.hxx   |1 
 45 files changed, 711 insertions(+), 277 deletions(-)

New commits:
commit feb680acb5dc25d6789289ce52812b11fa69e0c2
Author: Patrick Luby 
AuthorDate: Mon Feb 19 15:11:56 2024 -0500
Commit: Andras Timar 
CommitDate: Wed Feb 21 18:08:10 2024 +0100

tdf#126638 dispatch key shortcut events to modal windows

Some modal windows, such as the native Open and Save dialogs,
return NO from -[NSWindow performKeyEquivalent:]. Fortunately,
the main menu's -[NSMenu performKeyEquivalent:] is then called
so we can catch and redirect any modal window's key shortcut
events without triggering the modal window's "disallowed
action" beep.

Change-Id: Ib1fff68ab159361ceb847881e3a4da4736a33f51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163605
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 64ca3756416f0355b2008f39120e68ac42269784)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163618
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/inc/osx/salnsmenu.h b/vcl/inc/osx/salnsmenu.h
index 696abca2fc0b..9e0f9acf68ed 100644
--- a/vcl/inc/osx/salnsmenu.h
+++ b/vcl/inc/osx/salnsmenu.h
@@ -35,17 +35,25 @@ class AquaSalMenuItem;
 {
 AquaSalMenu* mpMenu;
 }
++ (BOOL)dispatchSpecialKeyEquivalents:(NSEvent*)pEvent;
 - (id)initWithMenu:(AquaSalMenu*)pMenu;
 - (void)menuNeedsUpdate:(NSMenu*)pMenu;
 - (void)setSalMenu:(AquaSalMenu*)pMenu;
 @end
 
-@interface SalNSMenuItem : NSMenuItem
+@interface SalNSMenuItem : NSMenuItem 
 {
 

core.git: external/harfbuzz

2024-02-21 Thread Patrick Luby (via logerrit)
 external/harfbuzz/UnpackedTarball_harfbuzz.mk |1 
 external/harfbuzz/tdf159529.patch.0   |   28 ++
 2 files changed, 29 insertions(+)

New commits:
commit af47a78e11d4819bb4b1ae1a1277babd10d815b7
Author: Patrick Luby 
AuthorDate: Tue Feb 20 19:06:04 2024 -0500
Commit: Caolán McNamara 
CommitDate: Wed Feb 21 10:53:23 2024 +0100

tdf#159529 clear hb_ot_face_t data after fetching 'sbix' and 'glyf' tables

The 'sbix' and 'glyf' tables can be very large for color emoji fonts
so clear any cached data in hb_ot_face_t after fetching that table's
extents.

Change-Id: Id5deda9114b7199a4194ff16879e5791acd1cd82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163674
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk 
b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
index 9bc9e326b426..71627725fae7 100644
--- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk
+++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
@@ -16,6 +16,7 @@ $(eval $(call 
gb_UnpackedTarball_update_autoconf_configs,harfbuzz))
 $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
 
 $(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
+external/harfbuzz/tdf159529.patch.0 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/harfbuzz/tdf159529.patch.0 
b/external/harfbuzz/tdf159529.patch.0
new file mode 100644
index ..d76313ce83be
--- /dev/null
+++ b/external/harfbuzz/tdf159529.patch.0
@@ -0,0 +1,28 @@
+--- ./src/hb-ot-font.cc2023-11-11 09:08:45
 ./src/hb-ot-font.cc2024-02-20 18:53:55
+@@ -428,13 +428,23 @@
+   const hb_ot_face_t *ot_face = ot_font->ot_face;
+ 
+ #if !defined(HB_NO_OT_FONT_BITMAP) && !defined(HB_NO_COLOR)
+-  if (ot_face->sbix->get_extents (font, glyph, extents)) return true;
++  /* tdf#159529 clear the hb_ot_face_t's data after fetching 'sbix' table
++   * The 'sbix' table can be very large for color emoji fonts so clear any
++   * cached data in hb_ot_face_t after fetching that table's extents. */
++  bool sbixResult = ot_face->sbix->get_extents (font, glyph, extents);
++  const_cast(ot_face)->sbix.fini ();
++  if (sbixResult) return true;
+   if (ot_face->CBDT->get_extents (font, glyph, extents)) return true;
+ #endif
+ #if !defined(HB_NO_COLOR) && !defined(HB_NO_PAINT)
+   if (ot_face->COLR->get_extents (font, glyph, extents)) return true;
+ #endif
+-  if (ot_face->glyf->get_extents (font, glyph, extents)) return true;
++  /* tdf#159529 clear the hb_ot_face_t's data after fetching 'glyf' table
++   * The 'glyf' table can be very large for color emoji fonts so clear any
++   * cached data in hb_ot_face_t after fetching that table's extents. */
++  bool glyfResult = ot_face->glyf->get_extents (font, glyph, extents);
++  const_cast(ot_face)->glyf.fini ();
++  if (glyfResult) return true;
+ #ifndef HB_NO_OT_FONT_CFF
+   if (ot_face->cff2->get_extents (font, glyph, extents)) return true;
+   if (ot_face->cff1->get_extents (font, glyph, extents)) return true;


core.git: Branch 'libreoffice-24-2' - vcl/inc vcl/osx

2024-02-20 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/salnsmenu.h |   10 +-
 vcl/osx/salmenu.cxx |   13 ++-
 vcl/osx/salnsmenu.mm|   80 
 vcl/osx/vclnsapp.mm |   49 ++---
 4 files changed, 111 insertions(+), 41 deletions(-)

New commits:
commit 0060f63d88425149bb37331eb31d0f90372a2957
Author: Patrick Luby 
AuthorDate: Mon Feb 19 15:11:56 2024 -0500
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Feb 21 07:39:14 2024 +0100

tdf#126638 dispatch key shortcut events to modal windows

Some modal windows, such as the native Open and Save dialogs,
return NO from -[NSWindow performKeyEquivalent:]. Fortunately,
the main menu's -[NSMenu performKeyEquivalent:] is then called
so we can catch and redirect any modal window's key shortcut
events without triggering the modal window's "disallowed
action" beep.

Change-Id: Ib1fff68ab159361ceb847881e3a4da4736a33f51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163605
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 64ca3756416f0355b2008f39120e68ac42269784)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163618
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/inc/osx/salnsmenu.h b/vcl/inc/osx/salnsmenu.h
index 696abca2fc0b..9e0f9acf68ed 100644
--- a/vcl/inc/osx/salnsmenu.h
+++ b/vcl/inc/osx/salnsmenu.h
@@ -35,17 +35,25 @@ class AquaSalMenuItem;
 {
 AquaSalMenu* mpMenu;
 }
++ (BOOL)dispatchSpecialKeyEquivalents:(NSEvent*)pEvent;
 - (id)initWithMenu:(AquaSalMenu*)pMenu;
 - (void)menuNeedsUpdate:(NSMenu*)pMenu;
 - (void)setSalMenu:(AquaSalMenu*)pMenu;
 @end
 
-@interface SalNSMenuItem : NSMenuItem
+@interface SalNSMenuItem : NSMenuItem 
 {
 AquaSalMenuItem* mpMenuItem;
 }
 - (id)initWithMenuItem:(AquaSalMenuItem*)pMenuItem;
 - (void)menuItemTriggered:(id)aSender;
+- (BOOL)validateMenuItem:(NSMenuItem*)pMenuItem;
+@end
+
+@interface SalNSMainMenu : NSMenu
+{
+}
+- (BOOL)performKeyEquivalent:(NSEvent*)pEvent;
 @end
 
 #endif // INCLUDED_VCL_INC_OSX_SALNSMENU_H
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index b3d02587f46b..6ea16a6588ae 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -125,7 +125,9 @@ static void initAppMenu()
 NSMenu* pAppMenu = nil;
 NSMenuItem* pNewItem = nil;
 
-NSMenu* pMainMenu = [[[NSMenu alloc] initWithTitle: @"Main Menu"] 
autorelease];
+// Related: tdf#126638 use NSMenu subclass to catch and redirect key
+// shortcuts when a modal window is displayed
+SalNSMainMenu* pMainMenu = [[[SalNSMainMenu alloc] initWithTitle: @"Main 
Menu"] autorelease];
 pNewItem = [pMainMenu addItemWithTitle: @"Application"
 action: nil
 keyEquivalent: @""];
@@ -230,12 +232,19 @@ AquaSalMenu::AquaSalMenu( bool bMenuBar ) :
 {
 mpMenu = [[SalNSMenu alloc] initWithMenu: this];
 [mpMenu setDelegate: reinterpret_cast< id >(mpMenu)];
+
+// Related: tdf#126638 enable the menu's "autoenabledItems" property
+// Enable the menu's "autoenabledItems" property so that
+// -[SalNSMenuItem validateMenuItem:] will be called before handling
+// a key shortcut and the menu item can be temporarily disabled if a
+// modal window is displayed.
+[mpMenu setAutoenablesItems: YES];
 }
 else
 {
 mpMenu = [NSApp mainMenu];
+[mpMenu setAutoenablesItems: NO];
 }
-[mpMenu setAutoenablesItems: NO];
 }
 
 AquaSalMenu::~AquaSalMenu()
diff --git a/vcl/osx/salnsmenu.mm b/vcl/osx/salnsmenu.mm
index b2df2da7e5f5..31627a35ea87 100644
--- a/vcl/osx/salnsmenu.mm
+++ b/vcl/osx/salnsmenu.mm
@@ -30,6 +30,53 @@
 #include 
 
 @implementation SalNSMenu
+
++(BOOL)dispatchSpecialKeyEquivalents: (NSEvent*)pEvent
+{
+if( pEvent && [pEvent type] == NSEventTypeKeyDown )
+{
+unsigned int nModMask = ([pEvent modifierFlags] & 
(NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand));
+if( nModMask == NSEventModifierFlagCommand )
+{
+if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"v"] )
+{
+if( [NSApp sendAction: @selector(paste:) to: nil from: nil] )
+return YES;
+}
+else if( [[pEvent charactersIgnoringModifiers] isEqualToString: 
@"c"] )
+{
+if( [NSApp sendAction: @selector(copy:) to: nil from: nil] )
+return YES;
+}
+else if( [[pEvent charactersIgnoringModifiers] isEqualToString: 
@"x"] )
+{
+if( [NSApp sendAction: @selector(cut:) to: nil from: nil] )
+return YES;
+}
+else if( [[pEvent charactersIgnoringModifiers] isEqualToString: 
@"a"] )
+{
+if( [NSApp sendAction: @selector(selectAll:) to: nil from: 
nil] )
+return YES;
+ 

core.git: vcl/inc vcl/osx

2024-02-19 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/salnsmenu.h |8 ++--
 vcl/osx/salmenu.cxx |9 +++--
 vcl/osx/salnsmenu.mm|   26 +++---
 3 files changed, 16 insertions(+), 27 deletions(-)

New commits:
commit 64ca3756416f0355b2008f39120e68ac42269784
Author: Patrick Luby 
AuthorDate: Mon Feb 19 15:11:56 2024 -0500
Commit: Patrick Luby 
CommitDate: Mon Feb 19 22:07:49 2024 +0100

tdf#126638 dispatch key shortcut events to modal windows

While commit 4f907fbe52749265ba4eb7c40ed187b453bb1de9 fixed
tdf#126638, it caused the "disallowed action" beep.

Some modal windows, such as the native Open and Save dialogs,
return NO from -[NSWindow performKeyEquivalent:]. Fortunately,
the main menu's -[NSMenu performKeyEquivalent:] is then called
so we can catch and redirect any modal window's key shortcut
events without triggering the modal window's "disallowed
action" beep.

Change-Id: Ib1fff68ab159361ceb847881e3a4da4736a33f51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163605
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/inc/osx/salnsmenu.h b/vcl/inc/osx/salnsmenu.h
index 64b65e2c95bd..9e0f9acf68ed 100644
--- a/vcl/inc/osx/salnsmenu.h
+++ b/vcl/inc/osx/salnsmenu.h
@@ -50,14 +50,10 @@ class AquaSalMenuItem;
 - (BOOL)validateMenuItem:(NSMenuItem*)pMenuItem;
 @end
 
-@interface SalNSMainMenuDelegate : NSObject
+@interface SalNSMainMenu : NSMenu
 {
 }
-- (id)init;
-- (BOOL)menuHasKeyEquivalent:(NSMenu*)pMenu
-forEvent:(NSEvent*)pEvent
-  target:(id*)pTarget
-  action:(SEL*)pAction;
+- (BOOL)performKeyEquivalent:(NSEvent*)pEvent;
 @end
 
 #endif // INCLUDED_VCL_INC_OSX_SALNSMENU_H
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index 7685a1b9e1bc..6ea16a6588ae 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -113,7 +113,6 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = nullptr;
 
 // FIXME: currently this is leaked
 static MainMenuSelector* pMainMenuSelector = nil;
-static SalNSMainMenuDelegate* pMainMenuDelegate = nil;
 
 static void initAppMenu()
 {
@@ -126,7 +125,9 @@ static void initAppMenu()
 NSMenu* pAppMenu = nil;
 NSMenuItem* pNewItem = nil;
 
-NSMenu* pMainMenu = [[[NSMenu alloc] initWithTitle: @"Main Menu"] 
autorelease];
+// Related: tdf#126638 use NSMenu subclass to catch and redirect key
+// shortcuts when a modal window is displayed
+SalNSMainMenu* pMainMenu = [[[SalNSMainMenu alloc] initWithTitle: @"Main 
Menu"] autorelease];
 pNewItem = [pMainMenu addItemWithTitle: @"Application"
 action: nil
 keyEquivalent: @""];
@@ -135,10 +136,6 @@ static void initAppMenu()
 [NSApp setMainMenu: pMainMenu];
 
 pMainMenuSelector = [[MainMenuSelector alloc] init];
-pMainMenuDelegate = [[SalNSMainMenuDelegate alloc] init];
-
-// tdf#126638 set a special delegate for the main menu
-[pMainMenu setDelegate: reinterpret_cast< id 
>(pMainMenuDelegate)];
 
 // about
 NSString* pString = CreateNSString(VclResId(SV_STDTEXT_ABOUT));
diff --git a/vcl/osx/salnsmenu.mm b/vcl/osx/salnsmenu.mm
index 0659e412db1a..31627a35ea87 100644
--- a/vcl/osx/salnsmenu.mm
+++ b/vcl/osx/salnsmenu.mm
@@ -317,27 +317,23 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 }
 @end
 
-@implementation SalNSMainMenuDelegate
+@implementation SalNSMainMenu
 
--(id)init
+- (BOOL)performKeyEquivalent:(NSEvent*)pEvent
 {
-return [super init];
-}
-
--(BOOL)menuHasKeyEquivalent: (NSMenu*)pMenu forEvent: (NSEvent*)pEvent target: 
(id*)pTarget action: (SEL*)pAction
-{
-assert( pMenu == [NSApp mainMenu] );
+BOOL bRet = [super performKeyEquivalent: pEvent];
 
 // tdf#126638 dispatch key shortcut events to modal windows
 // Some modal windows, such as the native Open and Save dialogs,
-// ignore any key shortcut events so use the same existing special
-// dispatching code that -[VCL_NSApplication sendEvent:] uses to
-// dispatch key shortcuts to non-modal, non-LibreOffice windows.
-if( [NSApp modalWindow] )
-[SalNSMenu dispatchSpecialKeyEquivalents: pEvent];
+// return NO from -[NSWindow performKeyEquivalent:]. Fortunately,
+// the main menu's -[NSMenu performKeyEquivalent:] is then called
+// so we can catch and redirect any modal window's key shortcut
+// events without triggering the modal window's "disallowed
+// action" beep.
+if( !bRet && [NSApp modalWindow] )
+bRet = [SalNSMenu dispatchSpecialKeyEquivalents: pEvent];
 
-// Always return NO since the target and action are not set
-return NO;
+return bRet;
 }
 
 @end


core.git: desktop/Executable_soffice_bin.mk desktop/util

2024-02-18 Thread Patrick Luby (via logerrit)
 desktop/Executable_soffice_bin.mk |   23 ---
 dev/null  |binary
 2 files changed, 23 deletions(-)

New commits:
commit 3e0f6665e3c9b7432404eb49efd74bff91f62935
Author: Patrick Luby 
AuthorDate: Sun Feb 18 20:26:08 2024 +0100
Commit: Patrick Luby 
CommitDate: Sun Feb 18 22:02:53 2024 +0100

Revert "tdf#152524 Add a __objc_fork_ok data section for Mac Intel 
executable"

This reverts commit c6652e280b0690497abf27380dd064898f91db32.

Reason for revert: patch may no longer be needed after commit 
b0656e6ca668a0719fbcb71b6d46c68093dda470.

Change-Id: I20da2d0ff576f82272efbb193148e77c44a73d5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163540
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/desktop/Executable_soffice_bin.mk 
b/desktop/Executable_soffice_bin.mk
index 086abbae4df0..ad391b3dbc19 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -66,27 +66,4 @@ endif
 
 endif
 
-ifeq ($(OS),MACOSX)
-ifeq ($(CPUNAME),X86_64)
-
-# tdf#152524 Add a __objc_fork_ok data section for Mac Intel executable
-# This attempts to fix a particularly difficult to debug crash due to
-# memory corruption when gpgme tries to fork and exec a gpg command.
-# For more background, see the following bug comment:
-#   https://bugs.documentfoundation.org/show_bug.cgi?id=152524#c39
-# This data section is only added in Mac Intel builds as it is a
-# controversial approach and I have not seen any reports of this bug
-# on Mac Silicon yet. So limit the fix only to Mac Intel in the hope
-# that this controversial approach will automatically phase itself
-# out when Apple eventually stops releasing new versions of macOS
-# for Mac Intel.
-# Note: the Objective C runtime doesn't appear to check the value of
-# this data section, but set it to 1 in case that changes in the future.
-$(eval $(call gb_Executable_add_ldflags,soffice_bin,\
--sectcreate __DATA __objc_fork_ok 
$(SRCDIR)/desktop/util/macos/__objc_fork_ok_data.txt \
-))
-
-endif
-endif
-
 # vim: set ts=4 sw=4 et:
diff --git a/desktop/util/macos/__objc_fork_ok_data.txt 
b/desktop/util/macos/__objc_fork_ok_data.txt
deleted file mode 100644
index f66c9cf4c967..
Binary files a/desktop/util/macos/__objc_fork_ok_data.txt and /dev/null differ


core.git: vcl/inc vcl/osx

2024-02-18 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/salnsmenu.h |   14 +++-
 vcl/osx/salmenu.cxx |   14 +++-
 vcl/osx/salnsmenu.mm|   84 
 vcl/osx/vclnsapp.mm |   49 ++--
 4 files changed, 121 insertions(+), 40 deletions(-)

New commits:
commit 4f907fbe52749265ba4eb7c40ed187b453bb1de9
Author: Patrick Luby 
AuthorDate: Sat Feb 17 10:33:08 2024 -0500
Commit: Patrick Luby 
CommitDate: Sun Feb 18 13:38:15 2024 +0100

tdf#126638 dispatch key shortcut events to modal windows

Some modal windows, such as the native Open and Save dialogs,
ignore any key shortcut events so use the same existing special
dispatching code that -[VCL_NSApplication sendEvent:] uses to
dispatch key shortcuts to non-modal, non-LibreOffice windows.

Also, disable all menu items when displaying modal windows. For
some unknown reason, key shortcuts are dispatched to the main
menu instead of the modal window so enable the "autoenabledItems"
property instances so that -[SalNSMenuItem validateMenuItem:]
will be called before handling a key shortcut and the menu item
can be temporarily disabled if a modal window is displayed.

Change-Id: I6c06024dd6ed05a4ee83f2b37e29c555b52ef555
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163527
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/inc/osx/salnsmenu.h b/vcl/inc/osx/salnsmenu.h
index 696abca2fc0b..64b65e2c95bd 100644
--- a/vcl/inc/osx/salnsmenu.h
+++ b/vcl/inc/osx/salnsmenu.h
@@ -35,17 +35,29 @@ class AquaSalMenuItem;
 {
 AquaSalMenu* mpMenu;
 }
++ (BOOL)dispatchSpecialKeyEquivalents:(NSEvent*)pEvent;
 - (id)initWithMenu:(AquaSalMenu*)pMenu;
 - (void)menuNeedsUpdate:(NSMenu*)pMenu;
 - (void)setSalMenu:(AquaSalMenu*)pMenu;
 @end
 
-@interface SalNSMenuItem : NSMenuItem
+@interface SalNSMenuItem : NSMenuItem 
 {
 AquaSalMenuItem* mpMenuItem;
 }
 - (id)initWithMenuItem:(AquaSalMenuItem*)pMenuItem;
 - (void)menuItemTriggered:(id)aSender;
+- (BOOL)validateMenuItem:(NSMenuItem*)pMenuItem;
+@end
+
+@interface SalNSMainMenuDelegate : NSObject
+{
+}
+- (id)init;
+- (BOOL)menuHasKeyEquivalent:(NSMenu*)pMenu
+forEvent:(NSEvent*)pEvent
+  target:(id*)pTarget
+  action:(SEL*)pAction;
 @end
 
 #endif // INCLUDED_VCL_INC_OSX_SALNSMENU_H
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index b3d02587f46b..7685a1b9e1bc 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -113,6 +113,7 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = nullptr;
 
 // FIXME: currently this is leaked
 static MainMenuSelector* pMainMenuSelector = nil;
+static SalNSMainMenuDelegate* pMainMenuDelegate = nil;
 
 static void initAppMenu()
 {
@@ -134,6 +135,10 @@ static void initAppMenu()
 [NSApp setMainMenu: pMainMenu];
 
 pMainMenuSelector = [[MainMenuSelector alloc] init];
+pMainMenuDelegate = [[SalNSMainMenuDelegate alloc] init];
+
+// tdf#126638 set a special delegate for the main menu
+[pMainMenu setDelegate: reinterpret_cast< id 
>(pMainMenuDelegate)];
 
 // about
 NSString* pString = CreateNSString(VclResId(SV_STDTEXT_ABOUT));
@@ -230,12 +235,19 @@ AquaSalMenu::AquaSalMenu( bool bMenuBar ) :
 {
 mpMenu = [[SalNSMenu alloc] initWithMenu: this];
 [mpMenu setDelegate: reinterpret_cast< id >(mpMenu)];
+
+// Related: tdf#126638 enable the menu's "autoenabledItems" property
+// Enable the menu's "autoenabledItems" property so that
+// -[SalNSMenuItem validateMenuItem:] will be called before handling
+// a key shortcut and the menu item can be temporarily disabled if a
+// modal window is displayed.
+[mpMenu setAutoenablesItems: YES];
 }
 else
 {
 mpMenu = [NSApp mainMenu];
+[mpMenu setAutoenablesItems: NO];
 }
-[mpMenu setAutoenablesItems: NO];
 }
 
 AquaSalMenu::~AquaSalMenu()
diff --git a/vcl/osx/salnsmenu.mm b/vcl/osx/salnsmenu.mm
index b2df2da7e5f5..0659e412db1a 100644
--- a/vcl/osx/salnsmenu.mm
+++ b/vcl/osx/salnsmenu.mm
@@ -30,6 +30,53 @@
 #include 
 
 @implementation SalNSMenu
+
++(BOOL)dispatchSpecialKeyEquivalents: (NSEvent*)pEvent
+{
+if( pEvent && [pEvent type] == NSEventTypeKeyDown )
+{
+unsigned int nModMask = ([pEvent modifierFlags] & 
(NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand));
+if( nModMask == NSEventModifierFlagCommand )
+{
+if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"v"] )
+{
+if( [NSApp sendAction: @selector(paste:) to: nil from: nil] )
+return YES;
+}
+else if( [[pEvent charactersIgnoringModifiers] isEqualToString: 
@"c"] )
+{
+if( [NSApp sendAction: @selector(copy:) to: nil from: nil] )
+return YES;
+

core.git: solenv/bin

2024-02-15 Thread Patrick Luby (via logerrit)
 solenv/bin/macosx-codesign-app-bundle |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit c2ebc77e636e9cdefad6cef446a2f8acec1580f1
Author: Patrick Luby 
AuthorDate: Thu Feb 15 19:59:55 2024 -0500
Commit: Patrick Luby 
CommitDate: Fri Feb 16 03:29:08 2024 +0100

Related: tdf#159529 fix increasing failures when setting entitlements

Starting in one of the Xcode versions 15.2 or earlier, setting the
entitlements without a certificate started failing on Mac Silicon.
The hacky solution is to make a copy of the application's executable,
set the entitlements on that binary only, and then move the copied
binary back.

Change-Id: I25c32cbe6f9aa87e2d6c2c554a8a9cf48d79e75d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163468
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/solenv/bin/macosx-codesign-app-bundle 
b/solenv/bin/macosx-codesign-app-bundle
index 695b3ae97922..3f0003f9a4a2 100755
--- a/solenv/bin/macosx-codesign-app-bundle
+++ b/solenv/bin/macosx-codesign-app-bundle
@@ -59,7 +59,19 @@ if test -z "$MACOSX_CODESIGNING_IDENTITY"; then
 # set entitlements to allow Xcode's Instruments application to connect to
 # the application. Note: the following command fails on some Mac Intel
 # machines, and since this not a release build, ignore any failures.
-codesign --force --identifier="${MACOSX_BUNDLE_IDENTIFIER}" --sign - 
$entitlements "$APP_BUNDLE"
+# Related: tdf#159529 fix increasing failures when setting entitlements
+# Starting in one of the Xcode versions 15.2 or earlier, setting the
+# entitlements without a certificate started failing on Mac Silicon. 
+# The hacky solution is to make a copy of the application's executable,
+# set the entitlements on that binary only, and then move the copied
+# binary back.
+rm -f "$APP_BUNDLE/Contents/MacOS/soffice.withentitlements"
+cp "$APP_BUNDLE/Contents/MacOS/soffice" 
"$APP_BUNDLE/Contents/MacOS/soffice.withentitlements"
+if codesign --force --identifier="${MACOSX_BUNDLE_IDENTIFIER}" --sign - 
$entitlements "$APP_BUNDLE/Contents/MacOS/soffice.withentitlements"; then
+mv "$APP_BUNDLE/Contents/MacOS/soffice.withentitlements" 
"$APP_BUNDLE/Contents/MacOS/soffice"
+else
+rm "$APP_BUNDLE/Contents/MacOS/soffice.withentitlements"
+fi
 exit 0
 fi
 


core.git: Branch 'libreoffice-24-2' - sal/osl

2024-02-15 Thread Patrick Luby (via logerrit)
 sal/osl/unx/system.cxx |   26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

New commits:
commit 7fb33dc1e9ab0c2f48b7d5424e5bca5e9a14f709
Author: Patrick Luby 
AuthorDate: Sat Feb 10 19:11:25 2024 -0500
Commit: Caolán McNamara 
CommitDate: Thu Feb 15 18:28:30 2024 +0100

tdf#155710 handle conversion failures due to non-UTF8 strings

Windows and Linux paths can be passed as parameters to this function
and those paths may not always be UTF8 encoded like macOS paths.

Change-Id: I83f5ab491d3c0ddd938e512fbab3213af9ea16fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163223
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit fa1b6aa517966991ce1a1d0135bd5dfae331ab9a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163176
Reviewed-by: Caolán McNamara 

diff --git a/sal/osl/unx/system.cxx b/sal/osl/unx/system.cxx
index f19bd7053100..eba4fe01c6c5 100644
--- a/sal/osl/unx/system.cxx
+++ b/sal/osl/unx/system.cxx
@@ -48,11 +48,6 @@ int macxp_resolveAlias(char *path, int buflen)
   (void) buflen;
   return 0;
 #else
-  CFStringRef cfpath;
-  CFURLRef cfurl;
-  CFErrorRef cferror;
-  CFDataRef cfbookmark;
-
   // Don't even try anything for files inside the app bundle. Just a
   // waste of time.
 
@@ -74,12 +69,19 @@ int macxp_resolveAlias(char *path, int buflen)
   if ( unprocessedPath )
   *unprocessedPath = '
 
-  cfpath = CFStringCreateWithCString( nullptr, path, kCFStringEncodingUTF8 
);
-  cfurl = CFURLCreateWithFileSystemPath( nullptr, cfpath, 
kCFURLPOSIXPathStyle, false );
-  CFRelease( cfpath );
-  cferror = nullptr;
-  cfbookmark = CFURLCreateBookmarkDataFromFile( nullptr, cfurl,  );
-  CFRelease( cfurl );
+  // tdf#155710 handle conversion failures due to non-UTF8 strings
+  // Windows and Linux paths can be passed as parameters to this function
+  // and those paths may not always be UTF8 encoded like macOS paths.
+  CFStringRef cfpath = CFStringCreateWithCString( nullptr, path, 
kCFStringEncodingUTF8 );
+  CFErrorRef cferror = nullptr;
+  CFDataRef cfbookmark = nullptr;
+  if (cfpath)
+  {
+  CFURLRef cfurl = CFURLCreateWithFileSystemPath( nullptr, cfpath, 
kCFURLPOSIXPathStyle, false );
+  CFRelease( cfpath );
+  cfbookmark = CFURLCreateBookmarkDataFromFile( nullptr, cfurl, 
 );
+  CFRelease( cfurl );
+  }
 
   if ( cfbookmark == nullptr )
   {
@@ -91,7 +93,7 @@ int macxp_resolveAlias(char *path, int buflen)
   else
   {
   Boolean isStale;
-  cfurl = CFURLCreateByResolvingBookmarkData( nullptr, cfbookmark, 
kCFBookmarkResolutionWithoutUIMask,
+  CFURLRef cfurl = CFURLCreateByResolvingBookmarkData( nullptr, 
cfbookmark, kCFBookmarkResolutionWithoutUIMask,
   nullptr, nullptr, 
,  );
   CFRelease( cfbookmark );
   if ( cfurl == nullptr )


core.git: include/oox

2024-02-14 Thread Patrick Luby (via logerrit)
 include/oox/helper/progressbar.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6525b488c5eb85a790265b3b394323491ecd70a7
Author: Patrick Luby 
AuthorDate: Tue Feb 13 17:36:35 2024 -0500
Commit: Noel Grandin 
CommitDate: Wed Feb 14 09:40:12 2024 +0100

Fix build breakage with --enable-mergelibs on macOS

With Xcode 15.2, --enable-mergelibs started failing so export a couple
constructors.

Change-Id: If41b167bb349976f38c5da9385824d5f51dc5398
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163326
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/oox/helper/progressbar.hxx 
b/include/oox/helper/progressbar.hxx
index 7adcb75c5c61..5d77b3277152 100644
--- a/include/oox/helper/progressbar.hxx
+++ b/include/oox/helper/progressbar.hxx
@@ -37,7 +37,7 @@ namespace oox {
 
 /** Interface for progress bar classes.
  */
-class UNLESS_MERGELIBS(OOX_DLLPUBLIC) IProgressBar
+class OOX_DLLPUBLIC IProgressBar
 {
 public:
 virtual ~IProgressBar();


core.git: sal/osl

2024-02-11 Thread Patrick Luby (via logerrit)
 sal/osl/unx/system.cxx |   26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

New commits:
commit fa1b6aa517966991ce1a1d0135bd5dfae331ab9a
Author: Patrick Luby 
AuthorDate: Sat Feb 10 19:11:25 2024 -0500
Commit: Patrick Luby 
CommitDate: Sun Feb 11 13:39:10 2024 +0100

tdf#155710 handle conversion failures due to non-UTF8 strings

Windows and Linux paths can be passed as parameters to this function
and those paths may not always be UTF8 encoded like macOS paths.

Change-Id: I83f5ab491d3c0ddd938e512fbab3213af9ea16fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163223
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/sal/osl/unx/system.cxx b/sal/osl/unx/system.cxx
index f19bd7053100..eba4fe01c6c5 100644
--- a/sal/osl/unx/system.cxx
+++ b/sal/osl/unx/system.cxx
@@ -48,11 +48,6 @@ int macxp_resolveAlias(char *path, int buflen)
   (void) buflen;
   return 0;
 #else
-  CFStringRef cfpath;
-  CFURLRef cfurl;
-  CFErrorRef cferror;
-  CFDataRef cfbookmark;
-
   // Don't even try anything for files inside the app bundle. Just a
   // waste of time.
 
@@ -74,12 +69,19 @@ int macxp_resolveAlias(char *path, int buflen)
   if ( unprocessedPath )
   *unprocessedPath = '
 
-  cfpath = CFStringCreateWithCString( nullptr, path, kCFStringEncodingUTF8 
);
-  cfurl = CFURLCreateWithFileSystemPath( nullptr, cfpath, 
kCFURLPOSIXPathStyle, false );
-  CFRelease( cfpath );
-  cferror = nullptr;
-  cfbookmark = CFURLCreateBookmarkDataFromFile( nullptr, cfurl,  );
-  CFRelease( cfurl );
+  // tdf#155710 handle conversion failures due to non-UTF8 strings
+  // Windows and Linux paths can be passed as parameters to this function
+  // and those paths may not always be UTF8 encoded like macOS paths.
+  CFStringRef cfpath = CFStringCreateWithCString( nullptr, path, 
kCFStringEncodingUTF8 );
+  CFErrorRef cferror = nullptr;
+  CFDataRef cfbookmark = nullptr;
+  if (cfpath)
+  {
+  CFURLRef cfurl = CFURLCreateWithFileSystemPath( nullptr, cfpath, 
kCFURLPOSIXPathStyle, false );
+  CFRelease( cfpath );
+  cfbookmark = CFURLCreateBookmarkDataFromFile( nullptr, cfurl, 
 );
+  CFRelease( cfurl );
+  }
 
   if ( cfbookmark == nullptr )
   {
@@ -91,7 +93,7 @@ int macxp_resolveAlias(char *path, int buflen)
   else
   {
   Boolean isStale;
-  cfurl = CFURLCreateByResolvingBookmarkData( nullptr, cfbookmark, 
kCFBookmarkResolutionWithoutUIMask,
+  CFURLRef cfurl = CFURLCreateByResolvingBookmarkData( nullptr, 
cfbookmark, kCFBookmarkResolutionWithoutUIMask,
   nullptr, nullptr, 
,  );
   CFRelease( cfbookmark );
   if ( cfurl == nullptr )


core.git: external/gpgmepp

2024-02-08 Thread Patrick Luby (via logerrit)
 external/gpgmepp/macos-tdf152524.patch |   38 +
 1 file changed, 34 insertions(+), 4 deletions(-)

New commits:
commit b0656e6ca668a0719fbcb71b6d46c68093dda470
Author: Patrick Luby 
AuthorDate: Thu Feb 8 09:54:20 2024 -0500
Commit: Patrick Luby 
CommitDate: Thu Feb 8 18:58:29 2024 +0100

tdf#152524 use dispatch_async() instead of dispatch_sync()

Commit 839cf255e2670fdf8e974af38432aacf63be4e90 used dispatch_sync()
but, unfortunately, libdispatch will not create a new thread for the
queue. dispatch_async_and_wait() also doesn't necessary run the queue
in a separate thread so use dispatch_async() and block and wait for
the libdispatch task to complete.

Change-Id: I8babad30caa8a188483ddf4f62bae35f5b888dc8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163122
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
index a69fbd1cf139..ad6fbf8fe9cb 100644
--- a/external/gpgmepp/macos-tdf152524.patch
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -1,17 +1,18 @@
 --- src/posix-io.c 2023-02-01 11:50:48
 +++ src/posix-io.c 2024-02-05 19:16:00
-@@ -62,6 +62,10 @@
+@@ -62,6 +62,11 @@
  # endif
  #endif
  #include 
 +
 +#if HAVE_MACOS_SYSTEM
 +#include 
++#include 
 +#endif
  
  #include "util.h"
  #include "priv-io.h"
-@@ -517,12 +521,50 @@
+@@ -517,12 +522,79 @@
  }
  
  
@@ -38,18 +39,47 @@
 +   * run in a sequential queue in a non-main thread.  */
 +  static dispatch_queue_t queue = NULL;
 +  if (!queue)
-+  queue = dispatch_queue_create ("gpgmepp",
++  queue = dispatch_queue_create ("gpgmeppforkandexec",
 + DISPATCH_QUEUE_CONCURRENT);
 +  if (!queue)
 +  return -1;
 +
 +  __block int ret = -1;
-+  dispatch_sync(queue, ^{
++  __block int done = false;
++  __block pthread_mutex_t waitlock = PTHREAD_MUTEX_INITIALIZER;
++  __block pthread_cond_t waitcond = PTHREAD_COND_INITIALIZER;
++
++  if (pthread_mutex_lock())
++  return -1;
++
++  /* Use dispatch_async() to force the queue to run in a separate
++   * thread.  */
++  dispatch_async(queue, ^{
++  if (pthread_mutex_lock())
++  {
++  done = true;
++  pthread_cond_signal();
++  return;
++  }
++
 +  ret = _gpgme_io_spawn_macos (path, argv, flags,
 +   fd_list, atfork,
 +   atforkvalue, r_pid);
++
++  done = true;
++  pthread_cond_signal();
++  pthread_mutex_unlock();
 +  });
 +
++  /* dispatch_async_and_wait() doesn't necessarily force the queue
++   * to run in a separate thread so block and until the task has
++   * finished.  */
++  if (!done)
++  pthread_cond_wait(, );
++  pthread_cond_destroy();
++  pthread_mutex_unlock();
++  pthread_mutex_destroy();
++
 +  return ret;
 +}
 +


core.git: Branch 'libreoffice-24-2' - sw/source

2024-02-08 Thread Patrick Luby (via logerrit)
 sw/source/core/undo/undel.cxx |   27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

New commits:
commit e1c125f6027970710eaa27bfe3d39476060878ca
Author: Patrick Luby 
AuthorDate: Sat Jan 13 19:40:37 2024 -0500
Commit: Christian Lohmaier 
CommitDate: Thu Feb 8 13:30:44 2024 +0100

tdf#158740 fix crash by checking the end node's index

I don't know why m_nEndNode is larger than the size of the node
array, but adjusting m_nEndNode to the last element in the node
array stops the crashing.

Change-Id: I425589457c6729b6689a7046f063154a2496e811
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162035
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 9bfd8e69385930d8f558c767f7b29149324d1b70)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162211
Reviewed-by: Patrick Luby 
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 4c199c8ac321..7661b5951740 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -1152,14 +1152,25 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & 
rContext)
 SwNode& start(*rDoc.GetNodes()[m_nSttNode +
 ((m_bDelFullPara || !rDoc.GetNodes()[m_nSttNode]->IsTextNode() || 
pInsNd)
  ? 0 : 1)]);
-// don't include end node in the range: it may have been merged already
-// by the start node, or it may be merged by one of the moved nodes,
-// but if it isn't merged, its current frame(s) should be good...
-SwNode& end(*rDoc.GetNodes()[ m_bDelFullPara
-? delFullParaEndNode
-// tdf#147310 SwDoc::DeleteRowCol() may delete whole table - end 
must be node following table!
-: (m_nEndNode + (rDoc.GetNodes()[m_nSttNode]->IsTableNode() && 
rDoc.GetNodes()[m_nEndNode]->IsEndNode() ? 1 : 0))]);
-::MakeFrames(, start, end);
+// tdf#158740 fix crash by checking the end node's index
+// I don't know why m_nEndNode is larger than the size of the node
+// array, but adjusting m_nEndNode to the last element in the node
+// array stops the crashing.
+SwNodeOffset nCount(rDoc.GetNodes().Count());
+if (nCount > SwNodeOffset(0))
+{
+if (m_nEndNode > nCount - 1)
+m_nEndNode = nCount - 1;
+
+// don't include end node in the range: it may have been merged 
already
+// by the start node, or it may be merged by one of the moved 
nodes,
+// but if it isn't merged, its current frame(s) should be good...
+SwNode& end(*rDoc.GetNodes()[ m_bDelFullPara
+? delFullParaEndNode
+// tdf#147310 SwDoc::DeleteRowCol() may delete whole table - 
end must be node following table!
+: (m_nEndNode + (rDoc.GetNodes()[m_nSttNode]->IsTableNode() && 
rDoc.GetNodes()[m_nEndNode]->IsEndNode() ? 1 : 0))]);
+::MakeFrames(, start, end);
+}
 }
 
 if (pMovedNode)


core.git: Branch 'libreoffice-24-2' - xmlsecurity/inc xmlsecurity/source

2024-02-07 Thread Patrick Luby (via logerrit)
 xmlsecurity/inc/certificatechooser.hxx |   18 +++--
 xmlsecurity/source/component/documentdigitalsignatures.cxx |2 -
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |2 -
 3 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 32e4f2d4d6e93f9bd9f17bd847300727017ef092
Author: Patrick Luby 
AuthorDate: Tue Feb 6 19:43:39 2024 -0500
Commit: Patrick Luby 
CommitDate: Wed Feb 7 19:44:28 2024 +0100

Don't reuse CertificateChooser instances

Reusing the same instance will, in the following case, lead to a
crash. It appears that the CertificateChooser is getting disposed
somewhere as mpDialogImpl in its base class ends up being null:

1. Create an empty Writer document and add a digital signature
   in the Digital Signatures dialog
2. File > Save As the document, check the "Encrypt with GPG key"
   checkbox, press Encrypt, and crash in Dialog::ImplStartExecute()

Change-Id: I9aaa1bd449622e018b502d68c53d397255a1b61a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163065
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-by: Patrick Luby 
(cherry picked from commit f0a5cb1f77496d212a90b5303a9f4be8b8c0e283)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163025

diff --git a/xmlsecurity/inc/certificatechooser.hxx 
b/xmlsecurity/inc/certificatechooser.hxx
index 12303fbf1cd5..b0cf7c7cdcc4 100644
--- a/xmlsecurity/inc/certificatechooser.hxx
+++ b/xmlsecurity/inc/certificatechooser.hxx
@@ -51,8 +51,6 @@ enum class UserAction
 class CertificateChooser final : public weld::GenericDialogController
 {
 private:
-static inline CertificateChooser* mxInstance = nullptr;
-
 std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > 
> mxSecurityContexts;
 std::vector> mvUserData;
 
@@ -91,14 +89,18 @@ public:
UserAction eAction);
 virtual ~CertificateChooser() override;
 
-static CertificateChooser* getInstance(weld::Window* _pParent,
+static std::unique_ptr getInstance(weld::Window* 
_pParent,
 std::vector< css::uno::Reference< 
css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts,
 UserAction eAction) {
-if (!mxInstance)
-{
-mxInstance = new CertificateChooser(_pParent, 
std::move(rxSecurityContexts), eAction);
-}
-return mxInstance;
+// Don't reuse CertificateChooser instances
+// Reusing the same instance will, in the following case, lead to a
+// crash. It appears that the CertificateChooser is getting disposed
+// somewhere as mpDialogImpl in its base class ends up being null:
+// 1. Create an empty Writer document and add a digital signature
+//in the Digital Signatures dialog
+// 2. File > Save As the document, check the "Encrypt with GPG key"
+//checkbox, press Encrypt, and crash in Dialog::ImplStartExecute()
+return std::make_unique(_pParent, 
std::move(rxSecurityContexts), eAction);
 }
 
 short run() override;
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx 
b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 4ad63b36ed0b..c1768c0e953a 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -709,7 +709,7 @@ 
DocumentDigitalSignatures::chooseCertificatesImpl(std::map&
 xSecContexts.push_back(aSignatureManager.getGpgSecurityContext());
 }
 
-CertificateChooser* aChooser = 
CertificateChooser::getInstance(Application::GetFrameWeld(mxParentWindow), 
std::move(xSecContexts), eAction);
+std::unique_ptr aChooser = 
CertificateChooser::getInstance(Application::GetFrameWeld(mxParentWindow), 
std::move(xSecContexts), eAction);
 
 if (aChooser->run() != RET_OK)
 return { Reference< css::security::XCertificate >(nullptr) };
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index b1a2cd57c95e..8349a58a31ce 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -509,7 +509,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl, 
weld::Button&, void)
 if 
(DocumentSignatureHelper::CanSignWithGPG(maSignatureManager.getStore(), 
m_sODFVersion))
 xSecContexts.push_back(maSignatureManager.getGpgSecurityContext());
 
-CertificateChooser* aChooser = 
CertificateChooser::getInstance(m_xDialog.get(), std::move(xSecContexts), 
UserAction::Sign);
+std::unique_ptr aChooser = 
CertificateChooser::getInstance(m_xDialog.get(), std::move(xSecContexts), 
UserAction::Sign);
 if (aChooser->run() == RET_OK)
 {
 sal_Int32 nSecurityId;


core.git: xmlsecurity/inc xmlsecurity/source

2024-02-07 Thread Patrick Luby (via logerrit)
 xmlsecurity/inc/certificatechooser.hxx |   18 +++--
 xmlsecurity/source/component/documentdigitalsignatures.cxx |2 -
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |2 -
 3 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit efe414c4a88fde0e2ee1d4016010f21fbd6d01d7
Author: Patrick Luby 
AuthorDate: Tue Feb 6 19:43:39 2024 -0500
Commit: Patrick Luby 
CommitDate: Wed Feb 7 14:40:50 2024 +0100

Don't reuse CertificateChooser instances

Reusing the same instance will, in the following case, lead to a
crash. It appears that the CertificateChooser is getting disposed
somewhere as mpDialogImpl in its base class ends up being null:

1. Create an empty Writer document and add a digital signature
   in the Digital Signatures dialog
2. File > Save As the document, check the "Encrypt with GPG key"
   checkbox, press Encrypt, and crash in Dialog::ImplStartExecute()

Change-Id: I9aaa1bd449622e018b502d68c53d397255a1b61a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163065
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-by: Patrick Luby 

diff --git a/xmlsecurity/inc/certificatechooser.hxx 
b/xmlsecurity/inc/certificatechooser.hxx
index 12303fbf1cd5..b0cf7c7cdcc4 100644
--- a/xmlsecurity/inc/certificatechooser.hxx
+++ b/xmlsecurity/inc/certificatechooser.hxx
@@ -51,8 +51,6 @@ enum class UserAction
 class CertificateChooser final : public weld::GenericDialogController
 {
 private:
-static inline CertificateChooser* mxInstance = nullptr;
-
 std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > 
> mxSecurityContexts;
 std::vector> mvUserData;
 
@@ -91,14 +89,18 @@ public:
UserAction eAction);
 virtual ~CertificateChooser() override;
 
-static CertificateChooser* getInstance(weld::Window* _pParent,
+static std::unique_ptr getInstance(weld::Window* 
_pParent,
 std::vector< css::uno::Reference< 
css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts,
 UserAction eAction) {
-if (!mxInstance)
-{
-mxInstance = new CertificateChooser(_pParent, 
std::move(rxSecurityContexts), eAction);
-}
-return mxInstance;
+// Don't reuse CertificateChooser instances
+// Reusing the same instance will, in the following case, lead to a
+// crash. It appears that the CertificateChooser is getting disposed
+// somewhere as mpDialogImpl in its base class ends up being null:
+// 1. Create an empty Writer document and add a digital signature
+//in the Digital Signatures dialog
+// 2. File > Save As the document, check the "Encrypt with GPG key"
+//checkbox, press Encrypt, and crash in Dialog::ImplStartExecute()
+return std::make_unique(_pParent, 
std::move(rxSecurityContexts), eAction);
 }
 
 short run() override;
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx 
b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 4ad63b36ed0b..c1768c0e953a 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -709,7 +709,7 @@ 
DocumentDigitalSignatures::chooseCertificatesImpl(std::map&
 xSecContexts.push_back(aSignatureManager.getGpgSecurityContext());
 }
 
-CertificateChooser* aChooser = 
CertificateChooser::getInstance(Application::GetFrameWeld(mxParentWindow), 
std::move(xSecContexts), eAction);
+std::unique_ptr aChooser = 
CertificateChooser::getInstance(Application::GetFrameWeld(mxParentWindow), 
std::move(xSecContexts), eAction);
 
 if (aChooser->run() != RET_OK)
 return { Reference< css::security::XCertificate >(nullptr) };
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index b1a2cd57c95e..8349a58a31ce 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -509,7 +509,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl, 
weld::Button&, void)
 if 
(DocumentSignatureHelper::CanSignWithGPG(maSignatureManager.getStore(), 
m_sODFVersion))
 xSecContexts.push_back(maSignatureManager.getGpgSecurityContext());
 
-CertificateChooser* aChooser = 
CertificateChooser::getInstance(m_xDialog.get(), std::move(xSecContexts), 
UserAction::Sign);
+std::unique_ptr aChooser = 
CertificateChooser::getInstance(m_xDialog.get(), std::move(xSecContexts), 
UserAction::Sign);
 if (aChooser->run() == RET_OK)
 {
 sal_Int32 nSecurityId;


core.git: external/gpgmepp

2024-02-07 Thread Patrick Luby (via logerrit)
 external/gpgmepp/UnpackedTarball_gpgmepp.mk |1 
 external/gpgmepp/macos-tdf152524.patch  |   64 
 2 files changed, 65 insertions(+)

New commits:
commit 839cf255e2670fdf8e974af38432aacf63be4e90
Author: Patrick Luby 
AuthorDate: Mon Feb 5 19:52:14 2024 -0500
Commit: Caolán McNamara 
CommitDate: Wed Feb 7 09:46:25 2024 +0100

tdf#152524 fork() and exec() in a separate libdispatch queue

This is another attempt to stop the crashing in libdispatch by
running fork() and exec() within a libdispatch task that will
run in a sequential queue in a non-main thread.

Change-Id: I3249510c14cc32f7f769b59289fe8380dd22ab68
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163036
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk 
b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
index d7b7a8ab4dbe..dcbda38d591d 100644
--- a/external/gpgmepp/UnpackedTarball_gpgmepp.mk
+++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk
@@ -34,5 +34,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \
 external/gpgmepp/w32-include.patch \
 external/gpgmepp/Wincompatible-function-pointer-types.patch \
 external/gpgmepp/macos-macports-path.patch \
+external/gpgmepp/macos-tdf152524.patch \
 ))
 # vim: set noet sw=4 ts=4:
diff --git a/external/gpgmepp/macos-tdf152524.patch 
b/external/gpgmepp/macos-tdf152524.patch
new file mode 100644
index ..a69fbd1cf139
--- /dev/null
+++ b/external/gpgmepp/macos-tdf152524.patch
@@ -0,0 +1,64 @@
+--- src/posix-io.c 2023-02-01 11:50:48
 src/posix-io.c 2024-02-05 19:16:00
+@@ -62,6 +62,10 @@
+ # endif
+ #endif
+ #include 
++
++#if HAVE_MACOS_SYSTEM
++#include 
++#endif
+ 
+ #include "util.h"
+ #include "priv-io.h"
+@@ -517,12 +521,50 @@
+ }
+ 
+ 
++#if HAVE_MACOS_SYSTEM
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++ struct spawn_fd_item_s *fd_list,
++ void (*atfork) (void *opaque, int reserved),
++ void *atforkvalue, pid_t *r_pid);
++#endif /*HAVE_MACOS_SYSTEM*/
++
++
+ /* Returns 0 on success, -1 on error.  */
+ int
+ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
+struct spawn_fd_item_s *fd_list,
+void (*atfork) (void *opaque, int reserved),
+void *atforkvalue, pid_t *r_pid)
++#if HAVE_MACOS_SYSTEM
++{
++  /* tdf#152524 fork() and exec() in a separate libdispatch queue
++   * This is another attempt to stop the crashing in libdispatch by
++   * running fork() and exec() within a libdispatch task that will
++   * run in a sequential queue in a non-main thread.  */
++  static dispatch_queue_t queue = NULL;
++  if (!queue)
++  queue = dispatch_queue_create ("gpgmepp",
++ DISPATCH_QUEUE_CONCURRENT);
++  if (!queue)
++  return -1;
++
++  __block int ret = -1;
++  dispatch_sync(queue, ^{
++  ret = _gpgme_io_spawn_macos (path, argv, flags,
++   fd_list, atfork,
++   atforkvalue, r_pid);
++  });
++
++  return ret;
++}
++
++static int
++_gpgme_io_spawn_macos (const char *path, char *const argv[], unsigned int 
flags,
++ struct spawn_fd_item_s *fd_list,
++ void (*atfork) (void *opaque, int reserved),
++ void *atforkvalue, pid_t *r_pid)
++#endif /*HAVE_MACOS_SYSTEM*/
+ {
+   pid_t pid;
+   int i;


core.git: Branch 'libreoffice-24-2' - xmlsecurity/source

2024-02-05 Thread Patrick Luby (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit aebea827555c29b30eded9a4e158b58c063613dc
Author: Patrick Luby 
AuthorDate: Fri Feb 2 16:06:21 2024 -0500
Commit: Stephan Bergmann 
CommitDate: Mon Feb 5 16:55:50 2024 +0100

tdf#147291 add more default certificate manager application for macOS

Add the following applications to the macOS GUI servers list:

- Trusted Key Manager - CertEurope
- SCInterface Manager and SmartCard tools

Change-Id: Iec78171c6e82f0a072f5f06b79606560a8cc03cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162942
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
Reviewed-by: Stephan Bergmann 
(cherry picked from commit 538f7b45c0c2c08124e9ea51a0947504f142a4f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162909

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index d717ec9feaad..b1a2cd57c95e 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -128,6 +128,8 @@ namespace
 #elif defined MACOSX
 constexpr std::u16string_view aGUIServers[]
 = { u"/Applications/GPG Keychain.app",
+u"/Applications/Trusted Key Manager.app", // tdf#147291
+u"/Applications/SCinterface/scManager.app", // tdf#147291
 u"/System/Applications/Utilities/Keychain Access.app"};
 #else
 constexpr std::u16string_view aGUIServers[]


core.git: Branch 'libreoffice-24-2' - xmlsecurity/source

2024-02-05 Thread Patrick Luby (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   58 ++---
 1 file changed, 51 insertions(+), 7 deletions(-)

New commits:
commit ad8033e3beb9eeb44ecfb008f0caa2c5312fc951
Author: Patrick Luby 
AuthorDate: Thu Feb 1 11:07:30 2024 -0500
Commit: Stephan Bergmann 
CommitDate: Mon Feb 5 14:32:21 2024 +0100

tdf#159307 add default macOS certificate manager applications

Most, if not all, of the Linux certificate manager applications are
not available on macOS so create a separate list for macOS.

Also, fix uncloseable windows due to uncaught exceptions thrown by
XSystemShellExecute::execute(). Failure to catch such exceptions
would cause the document window to be uncloseable and the application
to be unquittable.

Change-Id: I9bc6dc9c6c9d054252b634874045cb066023214a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162887
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit 29bf86f7cb367705b13049e5f0b3faa8bb93638a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162900
Reviewed-by: Patrick Luby 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index f2bb37241b7c..d717ec9feaad 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -74,6 +74,10 @@
 #include 
 #endif
 
+#if defined MACOSX
+#include 
+#endif
+
 using namespace comphelper;
 using namespace css::security;
 using namespace css::uno;
@@ -121,6 +125,10 @@ namespace
 u"GNU\GnuPG\bin\kleopatra.exe",
 u"GNU\GnuPG\bin\launch-gpa.exe",
 u"GNU\GnuPG\bin\gpa.exe"};
+#elif defined MACOSX
+constexpr std::u16string_view aGUIServers[]
+= { u"/Applications/GPG Keychain.app",
+u"/System/Applications/Utilities/Keychain Access.app"};
 #else
 constexpr std::u16string_view aGUIServers[]
 = { u"kleopatra", u"seahorse", u"gpa", u"kgpg"};
@@ -175,12 +183,34 @@ void GetCertificateManager(OUString& sExecutable)
 
 for (const auto& rServer: aGUIServers)
 {
-osl::FileBase::RC searchError = osl::File::searchFileURL(
-OUString(rServer), aPath,
-aFoundGUIServer);
-if (searchError == osl::FileBase::E_None)
+bool bSetCertMgrPath = false;
+
+#ifdef MACOSX
+// On macOS, the list of default certificate manager applications
+// includes absolute paths so check if the path exists and is a
+// directory
+if (rServer.starts_with('/'))
+{
+OString aSysPath = OUString(rServer).toUtf8();
+if (struct stat st; stat(aSysPath.getStr(), ) == 0 && 
S_ISDIR(st.st_mode))
+{
+bSetCertMgrPath = true;
+sExecutable = rServer;
+}
+}
+#endif
+
+if (!bSetCertMgrPath)
+{
+osl::FileBase::RC searchError = osl::File::searchFileURL(
+OUString(rServer), aPath,
+aFoundGUIServer);
+if (searchError == osl::FileBase::E_None && 
osl::File::getSystemPathFromFileURL(aFoundGUIServer, sExecutable) == 
osl::FileBase::E_None)
+bSetCertMgrPath = true;
+}
+
+if (bSetCertMgrPath)
 {
-osl::File::getSystemPathFromFileURL(aFoundGUIServer, sExecutable);
 std::shared_ptr pBatch(
 comphelper::ConfigurationChanges::create());
 
officecfg::Office::Common::Security::Scripting::CertMgrPath::set(sExecutable,
@@ -558,8 +588,22 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, 
weld::Button&, void)
 uno::Reference xSystemShell(
 css::system::SystemShellExecute::create(xContext));
 
-xSystemShell->execute(sExecutable, OUString(),
-  css::system::SystemShellExecuteFlags::DEFAULTS);
+try
+{
+xSystemShell->execute(sExecutable, OUString(),
+  
css::system::SystemShellExecuteFlags::DEFAULTS);
+}
+catch (...)
+{
+// Related tdf#159307 fix uncloseable windows due to uncaught 
exception
+// XSystemShellExecute::execute() throws an exception for a variety
+// of common error conditions such as files or directories that
+// are non-existent or non-executable. Failure to catch such
+// exceptions would cause the document window to be uncloseable
+// and the application to be unquittable.
+TOOLS_WARN_EXCEPTION( "xmlsecurity.dialogs", "executable failed!" 
);
+sExecutable = OUString();
+}
 }
 
 OUString sDialogText = (sExecutable.isEmpty() ?


core.git: xmlsecurity/source

2024-02-05 Thread Patrick Luby (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 538f7b45c0c2c08124e9ea51a0947504f142a4f1
Author: Patrick Luby 
AuthorDate: Fri Feb 2 16:06:21 2024 -0500
Commit: Stephan Bergmann 
CommitDate: Mon Feb 5 09:03:56 2024 +0100

tdf#147291 add more default certificate manager application for macOS

Add the following applications to the macOS GUI servers list:

- Trusted Key Manager - CertEurope
- SCInterface Manager and SmartCard tools

Change-Id: Iec78171c6e82f0a072f5f06b79606560a8cc03cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162942
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index d717ec9feaad..b1a2cd57c95e 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -128,6 +128,8 @@ namespace
 #elif defined MACOSX
 constexpr std::u16string_view aGUIServers[]
 = { u"/Applications/GPG Keychain.app",
+u"/Applications/Trusted Key Manager.app", // tdf#147291
+u"/Applications/SCinterface/scManager.app", // tdf#147291
 u"/System/Applications/Utilities/Keychain Access.app"};
 #else
 constexpr std::u16string_view aGUIServers[]


core.git: xmlsecurity/source

2024-02-01 Thread Patrick Luby (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   58 ++---
 1 file changed, 51 insertions(+), 7 deletions(-)

New commits:
commit 29bf86f7cb367705b13049e5f0b3faa8bb93638a
Author: Patrick Luby 
AuthorDate: Thu Feb 1 11:07:30 2024 -0500
Commit: Stephan Bergmann 
CommitDate: Fri Feb 2 07:55:01 2024 +0100

tdf#159307 add default macOS certificate manager applications

Most, if not all, of the Linux certificate manager applications are
not available on macOS so create a separate list for macOS.

Also, fix uncloseable windows due to uncaught exceptions thrown by
XSystemShellExecute::execute(). Failure to catch such exceptions
would cause the document window to be uncloseable and the application
to be unquittable.

Change-Id: I9bc6dc9c6c9d054252b634874045cb066023214a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162887
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index f2bb37241b7c..d717ec9feaad 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -74,6 +74,10 @@
 #include 
 #endif
 
+#if defined MACOSX
+#include 
+#endif
+
 using namespace comphelper;
 using namespace css::security;
 using namespace css::uno;
@@ -121,6 +125,10 @@ namespace
 u"GNU\GnuPG\bin\kleopatra.exe",
 u"GNU\GnuPG\bin\launch-gpa.exe",
 u"GNU\GnuPG\bin\gpa.exe"};
+#elif defined MACOSX
+constexpr std::u16string_view aGUIServers[]
+= { u"/Applications/GPG Keychain.app",
+u"/System/Applications/Utilities/Keychain Access.app"};
 #else
 constexpr std::u16string_view aGUIServers[]
 = { u"kleopatra", u"seahorse", u"gpa", u"kgpg"};
@@ -175,12 +183,34 @@ void GetCertificateManager(OUString& sExecutable)
 
 for (const auto& rServer: aGUIServers)
 {
-osl::FileBase::RC searchError = osl::File::searchFileURL(
-OUString(rServer), aPath,
-aFoundGUIServer);
-if (searchError == osl::FileBase::E_None)
+bool bSetCertMgrPath = false;
+
+#ifdef MACOSX
+// On macOS, the list of default certificate manager applications
+// includes absolute paths so check if the path exists and is a
+// directory
+if (rServer.starts_with('/'))
+{
+OString aSysPath = OUString(rServer).toUtf8();
+if (struct stat st; stat(aSysPath.getStr(), ) == 0 && 
S_ISDIR(st.st_mode))
+{
+bSetCertMgrPath = true;
+sExecutable = rServer;
+}
+}
+#endif
+
+if (!bSetCertMgrPath)
+{
+osl::FileBase::RC searchError = osl::File::searchFileURL(
+OUString(rServer), aPath,
+aFoundGUIServer);
+if (searchError == osl::FileBase::E_None && 
osl::File::getSystemPathFromFileURL(aFoundGUIServer, sExecutable) == 
osl::FileBase::E_None)
+bSetCertMgrPath = true;
+}
+
+if (bSetCertMgrPath)
 {
-osl::File::getSystemPathFromFileURL(aFoundGUIServer, sExecutable);
 std::shared_ptr pBatch(
 comphelper::ConfigurationChanges::create());
 
officecfg::Office::Common::Security::Scripting::CertMgrPath::set(sExecutable,
@@ -558,8 +588,22 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, 
weld::Button&, void)
 uno::Reference xSystemShell(
 css::system::SystemShellExecute::create(xContext));
 
-xSystemShell->execute(sExecutable, OUString(),
-  css::system::SystemShellExecuteFlags::DEFAULTS);
+try
+{
+xSystemShell->execute(sExecutable, OUString(),
+  
css::system::SystemShellExecuteFlags::DEFAULTS);
+}
+catch (...)
+{
+// Related tdf#159307 fix uncloseable windows due to uncaught 
exception
+// XSystemShellExecute::execute() throws an exception for a variety
+// of common error conditions such as files or directories that
+// are non-existent or non-executable. Failure to catch such
+// exceptions would cause the document window to be uncloseable
+// and the application to be unquittable.
+TOOLS_WARN_EXCEPTION( "xmlsecurity.dialogs", "executable failed!" 
);
+sExecutable = OUString();
+}
 }
 
 OUString sDialogText = (sExecutable.isEmpty() ?


core.git: desktop/Executable_soffice_bin.mk desktop/util

2024-01-26 Thread Patrick Luby (via logerrit)
 desktop/Executable_soffice_bin.mk  |   23 +++
 desktop/util/macos/__objc_fork_ok_data.txt |binary
 2 files changed, 23 insertions(+)

New commits:
commit c6652e280b0690497abf27380dd064898f91db32
Author: Patrick Luby 
AuthorDate: Fri Jan 26 12:19:17 2024 -0500
Commit: Patrick Luby 
CommitDate: Fri Jan 26 21:44:05 2024 +0100

tdf#152524 Add a __objc_fork_ok data section for Mac Intel executable

This attempts to fix a particularly difficult to debug crash due to
memory corruption when gpgme tries to fork and exec a gpg command.
For more background, see the following bug comment:

  https://bugs.documentfoundation.org/show_bug.cgi?id=152524#c39

This data section is only added in Mac Intel builds as it is a
controversial approach and I have not seen any reports of this bug
on Mac Silicon yet. So limit the fix only to Mac Intel in the hope
that this controversial approach will automatically phase itself
out when Apple eventually stops releasing new versions of macOS
for Mac Intel.

Note: the Objective C runtime doesn't appear to check the value of
this data section, but set it to 1 in case that changes in the future.

Change-Id: Ifac7893589a9183e092724297aff93eb3d58ab70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162634
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/desktop/Executable_soffice_bin.mk 
b/desktop/Executable_soffice_bin.mk
index c2d811c2e86c..fbdf07a5e531 100644
--- a/desktop/Executable_soffice_bin.mk
+++ b/desktop/Executable_soffice_bin.mk
@@ -58,4 +58,27 @@ $(eval $(call gb_Executable_add_ldflags,soffice_bin,\
 
 endif
 
+ifeq ($(OS),MACOSX)
+ifeq ($(CPUNAME),X86_64)
+
+# tdf#152524 Add a __objc_fork_ok data section for Mac Intel executable
+# This attempts to fix a particularly difficult to debug crash due to
+# memory corruption when gpgme tries to fork and exec a gpg command.
+# For more background, see the following bug comment:
+#   https://bugs.documentfoundation.org/show_bug.cgi?id=152524#c39
+# This data section is only added in Mac Intel builds as it is a
+# controversial approach and I have not seen any reports of this bug
+# on Mac Silicon yet. So limit the fix only to Mac Intel in the hope
+# that this controversial approach will automatically phase itself
+# out when Apple eventually stops releasing new versions of macOS
+# for Mac Intel.
+# Note: the Objective C runtime doesn't appear to check the value of
+# this data section, but set it to 1 in case that changes in the future.
+$(eval $(call gb_Executable_add_ldflags,soffice_bin,\
+-sectcreate __DATA __objc_fork_ok 
$(SRCDIR)/desktop/util/macos/__objc_fork_ok_data.txt \
+))
+
+endif
+endif
+
 # vim: set ts=4 sw=4 et:
diff --git a/desktop/util/macos/__objc_fork_ok_data.txt 
b/desktop/util/macos/__objc_fork_ok_data.txt
new file mode 100644
index ..f66c9cf4c967
Binary files /dev/null and b/desktop/util/macos/__objc_fork_ok_data.txt differ


core.git: helpcontent2

2024-01-24 Thread Patrick Luby (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b873dc28d9a5896cdf8b842742d191218a91ff41
Author: Patrick Luby 
AuthorDate: Wed Jan 24 16:18:06 2024 +0100
Commit: Gerrit Code Review 
CommitDate: Wed Jan 24 16:18:06 2024 +0100

Update git submodules

* Update helpcontent2 from branch 'master'
  to 5d2a29ee4f4556b0133e73ea429c9c1aaede0581
  - tdf#159307 macOS uses Command+Option+F while other plafforms use Ctrl+H

Change-Id: Iee37805afba1aa712a45c213d1f9eeae4d01d923
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162452
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/helpcontent2 b/helpcontent2
index 5c4fdb89c981..5d2a29ee4f45 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 5c4fdb89c9810bd961717a09a4c4cf177fa5b3d5
+Subproject commit 5d2a29ee4f4556b0133e73ea429c9c1aaede0581


help.git: source/text

2024-01-24 Thread Patrick Luby (via logerrit)
 source/text/shared/04/0101.xhp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5d2a29ee4f4556b0133e73ea429c9c1aaede0581
Author: Patrick Luby 
AuthorDate: Tue Jan 23 14:17:57 2024 +0100
Commit: Patrick Luby 
CommitDate: Wed Jan 24 16:18:06 2024 +0100

tdf#159307 macOS uses Command+Option+F while other plafforms use Ctrl+H

Change-Id: Iee37805afba1aa712a45c213d1f9eeae4d01d923
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/162452
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/source/text/shared/04/0101.xhp 
b/source/text/shared/04/0101.xhp
index 6ce842fd24..b13f80396c 100644
--- a/source/text/shared/04/0101.xhp
+++ b/source/text/shared/04/0101.xhp
@@ -240,7 +240,7 @@
   
   
 
-  CommandCtrl+H
+  Command+Option+FCtrl+H
 
 
   Calls 
the Find  Replace dialog.


core.git: Branch 'libreoffice-24-2-0' - sw/source

2024-01-23 Thread Patrick Luby (via logerrit)
 sw/source/core/undo/untbl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 0989275534bda8cd559e80b8579bba7271344e7d
Author: Patrick Luby 
AuthorDate: Sat Jan 13 17:57:56 2024 -0500
Commit: Patrick Luby 
CommitDate: Tue Jan 23 19:39:43 2024 +0100

tdf#159025 skip undo if SwTableNode is a nullptr

I don't know what causes the SwTableNode to be a nullptr in the
case of tdf#159025, but at least stop the crashing by skipping
this undo request.

Change-Id: Idad1ed290af215e591018ea58732b77ca504ba01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162031
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
(cherry picked from commit f414c61f8dd2617baa0851525b8a7a630c5e34da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162227
Reviewed-by: Michael Weghorn 
Reviewed-by: Ilmari Lauhakangas 
Tested-by: Patrick Luby 

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 6f122e73b6da..72f1c809e227 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -272,7 +272,14 @@ void SwUndoInsTable::UndoImpl(::sw::UndoRedoContext & 
rContext)
 SwNodeIndex aIdx( rDoc.GetNodes(), m_nStartNode );
 
 SwTableNode* pTableNd = aIdx.GetNode().GetTableNode();
-OSL_ENSURE( pTableNd, "no TableNode" );
+// tdf#159025 skip undo if SwTableNode is a nullptr
+// I don't know what causes the SwTableNode to be a nullptr in the
+// case of tdf#159025, but at least stop the crashing by skipping
+// this undo request.
+SAL_WARN_IF( !pTableNd, "sw.core", "no TableNode" );
+if( !pTableNd )
+return;
+
 pTableNd->DelFrames();
 
 if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-22 Thread Patrick Luby (via logerrit)
 sw/source/core/undo/untbl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 8163882de6308e46b261af9e75906d1d05c4eb08
Author: Patrick Luby 
AuthorDate: Sat Jan 13 17:57:56 2024 -0500
Commit: Patrick Luby 
CommitDate: Tue Jan 23 01:18:20 2024 +0100

tdf#159025 skip undo if SwTableNode is a nullptr

I don't know what causes the SwTableNode to be a nullptr in the
case of tdf#159025, but at least stop the crashing by skipping
this undo request.

Change-Id: Idad1ed290af215e591018ea58732b77ca504ba01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162031
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
(cherry picked from commit f414c61f8dd2617baa0851525b8a7a630c5e34da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162225

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 6f122e73b6da..72f1c809e227 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -272,7 +272,14 @@ void SwUndoInsTable::UndoImpl(::sw::UndoRedoContext & 
rContext)
 SwNodeIndex aIdx( rDoc.GetNodes(), m_nStartNode );
 
 SwTableNode* pTableNd = aIdx.GetNode().GetTableNode();
-OSL_ENSURE( pTableNd, "no TableNode" );
+// tdf#159025 skip undo if SwTableNode is a nullptr
+// I don't know what causes the SwTableNode to be a nullptr in the
+// case of tdf#159025, but at least stop the crashing by skipping
+// this undo request.
+SAL_WARN_IF( !pTableNd, "sw.core", "no TableNode" );
+if( !pTableNd )
+return;
+
 pTableNd->DelFrames();
 
 if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))


core.git: Branch 'libreoffice-7-6' - sw/source

2024-01-22 Thread Patrick Luby (via logerrit)
 sw/source/core/undo/untbl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 52e959efc36edaf3e5bd1cd8ad75d4541f861390
Author: Patrick Luby 
AuthorDate: Sat Jan 13 17:57:56 2024 -0500
Commit: Noel Grandin 
CommitDate: Mon Jan 22 13:11:32 2024 +0100

tdf#159025 skip undo if SwTableNode is a nullptr

I don't know what causes the SwTableNode to be a nullptr in the
case of tdf#159025, but at least stop the crashing by skipping
this undo request.

Change-Id: Idad1ed290af215e591018ea58732b77ca504ba01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162031
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
(cherry picked from commit f414c61f8dd2617baa0851525b8a7a630c5e34da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162228

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 3092df0c2fd3..8da85452c7d9 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -272,7 +272,14 @@ void SwUndoInsTable::UndoImpl(::sw::UndoRedoContext & 
rContext)
 SwNodeIndex aIdx( rDoc.GetNodes(), m_nStartNode );
 
 SwTableNode* pTableNd = aIdx.GetNode().GetTableNode();
-OSL_ENSURE( pTableNd, "no TableNode" );
+// tdf#159025 skip undo if SwTableNode is a nullptr
+// I don't know what causes the SwTableNode to be a nullptr in the
+// case of tdf#159025, but at least stop the crashing by skipping
+// this undo request.
+SAL_WARN_IF( !pTableNd, "sw.core", "no TableNode" );
+if( !pTableNd )
+return;
+
 pTableNd->DelFrames();
 
 if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))


core.git: sw/source

2024-01-18 Thread Patrick Luby (via logerrit)
 sw/source/core/undo/untbl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit fab9db6c7e85c76320743e1956c5a7c12f4ece0b
Author: Patrick Luby 
AuthorDate: Sat Jan 13 17:57:56 2024 -0500
Commit: Patrick Luby 
CommitDate: Thu Jan 18 13:13:22 2024 +0100

tdf#159025 skip undo if SwTableNode is a nullptr

I don't know what causes the SwTableNode to be a nullptr in the
case of tdf#159025, but at least stop the crashing by skipping
this undo request.

Change-Id: Idad1ed290af215e591018ea58732b77ca504ba01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162031
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 6f122e73b6da..72f1c809e227 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -272,7 +272,14 @@ void SwUndoInsTable::UndoImpl(::sw::UndoRedoContext & 
rContext)
 SwNodeIndex aIdx( rDoc.GetNodes(), m_nStartNode );
 
 SwTableNode* pTableNd = aIdx.GetNode().GetTableNode();
-OSL_ENSURE( pTableNd, "no TableNode" );
+// tdf#159025 skip undo if SwTableNode is a nullptr
+// I don't know what causes the SwTableNode to be a nullptr in the
+// case of tdf#159025, but at least stop the crashing by skipping
+// this undo request.
+SAL_WARN_IF( !pTableNd, "sw.core", "no TableNode" );
+if( !pTableNd )
+return;
+
 pTableNd->DelFrames();
 
 if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))


core.git: distro-configs/LibreOfficeiOS.conf distro-configs/LibreOfficeiOS_Sim.conf sfx2/source

2024-01-17 Thread Patrick Luby (via logerrit)
 distro-configs/LibreOfficeiOS.conf |3 -
 distro-configs/LibreOfficeiOS_Sim.conf |3 -
 sfx2/source/doc/guisaveas.cxx  |   68 -
 3 files changed, 62 insertions(+), 12 deletions(-)

New commits:
commit 12b33dce25a22e99c4f86f1ff139efb8dd144117
Author: Patrick Luby 
AuthorDate: Fri Jan 5 09:55:26 2024 -0500
Commit: Andras Timar 
CommitDate: Wed Jan 17 17:31:07 2024 +0100

Eliminate hang in iOS app (and maybe the Android app) during export

When exporting a document via this path, such as exporting to PDF
via the .uno:ExportToPDF command, any exceptions thrown while saving
the current document will leave the app in a blocked state if a
"PENDING" message has been sent.

The iOS app (and maybe the Android app) fails to set the URL to
save to so we need to set it to a temporary file.
Note: the iOS app is responsible for deleting the temporary file.

Also, enable building iOS with TLS=OPENSSL by default.

Signed-off-by: Patrick Luby 
Change-Id: Ibc070bed4e792bb0a481d2b900d12d214e3c519f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161692
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162125
Tested-by: Jenkins

diff --git a/distro-configs/LibreOfficeiOS.conf 
b/distro-configs/LibreOfficeiOS.conf
index c0ba243ab840..ab36e05ba668 100644
--- a/distro-configs/LibreOfficeiOS.conf
+++ b/distro-configs/LibreOfficeiOS.conf
@@ -24,7 +24,8 @@
 --disable-poppler
 --disable-python
 
---without-tls
+# OpenSSL is the default
+#--with-tls=openssl
 
 # iOS device
 --host=arm64-apple-ios
diff --git a/distro-configs/LibreOfficeiOS_Sim.conf 
b/distro-configs/LibreOfficeiOS_Sim.conf
index c121a29a9879..03558256657a 100644
--- a/distro-configs/LibreOfficeiOS_Sim.conf
+++ b/distro-configs/LibreOfficeiOS_Sim.conf
@@ -24,7 +24,8 @@
 --disable-poppler
 --disable-python
 
---without-tls
+# OpenSSL is the default
+#--with-tls=openssl
 
 # iOS simulator (debug)
 --enable-ios-simulator
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 657d162ff732..7b286321c217 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1101,12 +1101,48 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 
nStoreMode,
 
 if (comphelper::LibreOfficeKit::isActive())
 {
-// keep name with extension
-aSuggestedName = aRecommendedName;
-OUString aExtension;
-if (size_t nPos = aSuggestedName.lastIndexOf('.') + 1)
-aExtension = aSuggestedName.copy(nPos, aSuggestedName.getLength() 
- nPos);
-aURL.SetExtension(aExtension);
+#ifdef IOS
+// The iOS app (and maybe the Android app) have fails to set the URL to
+// save to so we need to set it to a temporary file.
+// Note: the iOS app is responsible for deleting the temporary file.
+if (nStoreMode & EXPORT_REQUESTED && 
aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE).isEmpty())
+{
+// Mirror the "export/docbasename.pdf" path format to match the
+// format used in the "downloadas" message handler in the iOS app's
+// -[DocumentViewController 
userContentController:didReceiveScriptMessage]
+// selector.
+// Important note: temporary files created here must be in their
+// own subdirectory since the iOS app's UIDocumentPickerDelegate
+// will try to delete both the temporary file and its parent
+// directory.
+OUString aFullName = u"export/" + aRecommendedName;
+OUString aBaseName;
+OUString aExtension;
+sal_Int32 nPos = aFullName.lastIndexOf( '.' );
+if ( nPos >= 0 )
+{
+aBaseName = aFullName.copy(0, nPos);
+aExtension = aFullName.copy(nPos, aFullName.getLength() - 
nPos);
+}
+aURL = INetURLObject(::utl::CreateTempURL( aBaseName, false, 
aExtension, nullptr, true));
+
+// Remove any stale files left from a previous export
+OUString fileURL = 
aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+if (!fileURL.isEmpty())
+osl::File::remove(fileURL);
+}
+else
+{
+#endif
+// keep name with extension
+aSuggestedName = aRecommendedName;
+OUString aExtension;
+if (size_t nPos = aSuggestedName.lastIndexOf('.') + 1)
+aExtension = aSuggestedName.copy(nPos, 
aSuggestedName.getLength() - nPos);
+aURL.SetExtension(aExtension);
+#ifdef IOS
+}
+#endif
 }
 else
 {
@@ -1822,10 +1858,22 @@ bool 
SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
 
 // this is actually a save operation with different parameters
 // so storeTo or storeAs without 

core.git: sw/source

2024-01-17 Thread Patrick Luby (via logerrit)
 sw/source/core/undo/undel.cxx |   27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 9bfd8e69385930d8f558c767f7b29149324d1b70
Author: Patrick Luby 
AuthorDate: Sat Jan 13 19:40:37 2024 -0500
Commit: Noel Grandin 
CommitDate: Wed Jan 17 09:57:58 2024 +0100

tdf#158740 fix crash by checking the end node's index

I don't know why m_nEndNode is larger than the size of the node
array, but adjusting m_nEndNode to the last element in the node
array stops the crashing.

Change-Id: I425589457c6729b6689a7046f063154a2496e811
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162035
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 4c199c8ac321..7661b5951740 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -1152,14 +1152,25 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & 
rContext)
 SwNode& start(*rDoc.GetNodes()[m_nSttNode +
 ((m_bDelFullPara || !rDoc.GetNodes()[m_nSttNode]->IsTextNode() || 
pInsNd)
  ? 0 : 1)]);
-// don't include end node in the range: it may have been merged already
-// by the start node, or it may be merged by one of the moved nodes,
-// but if it isn't merged, its current frame(s) should be good...
-SwNode& end(*rDoc.GetNodes()[ m_bDelFullPara
-? delFullParaEndNode
-// tdf#147310 SwDoc::DeleteRowCol() may delete whole table - end 
must be node following table!
-: (m_nEndNode + (rDoc.GetNodes()[m_nSttNode]->IsTableNode() && 
rDoc.GetNodes()[m_nEndNode]->IsEndNode() ? 1 : 0))]);
-::MakeFrames(, start, end);
+// tdf#158740 fix crash by checking the end node's index
+// I don't know why m_nEndNode is larger than the size of the node
+// array, but adjusting m_nEndNode to the last element in the node
+// array stops the crashing.
+SwNodeOffset nCount(rDoc.GetNodes().Count());
+if (nCount > SwNodeOffset(0))
+{
+if (m_nEndNode > nCount - 1)
+m_nEndNode = nCount - 1;
+
+// don't include end node in the range: it may have been merged 
already
+// by the start node, or it may be merged by one of the moved 
nodes,
+// but if it isn't merged, its current frame(s) should be good...
+SwNode& end(*rDoc.GetNodes()[ m_bDelFullPara
+? delFullParaEndNode
+// tdf#147310 SwDoc::DeleteRowCol() may delete whole table - 
end must be node following table!
+: (m_nEndNode + (rDoc.GetNodes()[m_nSttNode]->IsTableNode() && 
rDoc.GetNodes()[m_nEndNode]->IsEndNode() ? 1 : 0))]);
+::MakeFrames(, start, end);
+}
 }
 
 if (pMovedNode)


core.git: Branch 'distro/collabora/co-24.04' - distro-configs/LibreOfficeiOS.conf distro-configs/LibreOfficeiOS_Sim.conf sfx2/source

2024-01-15 Thread Patrick Luby (via logerrit)
 distro-configs/LibreOfficeiOS.conf |3 -
 distro-configs/LibreOfficeiOS_Sim.conf |3 -
 sfx2/source/doc/guisaveas.cxx  |   68 -
 3 files changed, 62 insertions(+), 12 deletions(-)

New commits:
commit 9a026f62bab0cc181ae58c880967ffd75ef06f5e
Author: Patrick Luby 
AuthorDate: Fri Jan 5 09:55:26 2024 -0500
Commit: Andras Timar 
CommitDate: Mon Jan 15 19:01:53 2024 +0100

Eliminate hang in iOS app (and maybe the Android app) during export

When exporting a document via this path, such as exporting to PDF
via the .uno:ExportToPDF command, any exceptions thrown while saving
the current document will leave the app in a blocked state if a
"PENDING" message has been sent.

The iOS app (and maybe the Android app) fails to set the URL to
save to so we need to set it to a temporary file.
Note: the iOS app is responsible for deleting the temporary file.

Also, enable building iOS with TLS=OPENSSL by default.

Signed-off-by: Patrick Luby 
Change-Id: Ibc070bed4e792bb0a481d2b900d12d214e3c519f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161692
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/distro-configs/LibreOfficeiOS.conf 
b/distro-configs/LibreOfficeiOS.conf
index c0ba243ab840..ab36e05ba668 100644
--- a/distro-configs/LibreOfficeiOS.conf
+++ b/distro-configs/LibreOfficeiOS.conf
@@ -24,7 +24,8 @@
 --disable-poppler
 --disable-python
 
---without-tls
+# OpenSSL is the default
+#--with-tls=openssl
 
 # iOS device
 --host=arm64-apple-ios
diff --git a/distro-configs/LibreOfficeiOS_Sim.conf 
b/distro-configs/LibreOfficeiOS_Sim.conf
index c121a29a9879..03558256657a 100644
--- a/distro-configs/LibreOfficeiOS_Sim.conf
+++ b/distro-configs/LibreOfficeiOS_Sim.conf
@@ -24,7 +24,8 @@
 --disable-poppler
 --disable-python
 
---without-tls
+# OpenSSL is the default
+#--with-tls=openssl
 
 # iOS simulator (debug)
 --enable-ios-simulator
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 657d162ff732..7b286321c217 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1101,12 +1101,48 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 
nStoreMode,
 
 if (comphelper::LibreOfficeKit::isActive())
 {
-// keep name with extension
-aSuggestedName = aRecommendedName;
-OUString aExtension;
-if (size_t nPos = aSuggestedName.lastIndexOf('.') + 1)
-aExtension = aSuggestedName.copy(nPos, aSuggestedName.getLength() 
- nPos);
-aURL.SetExtension(aExtension);
+#ifdef IOS
+// The iOS app (and maybe the Android app) have fails to set the URL to
+// save to so we need to set it to a temporary file.
+// Note: the iOS app is responsible for deleting the temporary file.
+if (nStoreMode & EXPORT_REQUESTED && 
aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE).isEmpty())
+{
+// Mirror the "export/docbasename.pdf" path format to match the
+// format used in the "downloadas" message handler in the iOS app's
+// -[DocumentViewController 
userContentController:didReceiveScriptMessage]
+// selector.
+// Important note: temporary files created here must be in their
+// own subdirectory since the iOS app's UIDocumentPickerDelegate
+// will try to delete both the temporary file and its parent
+// directory.
+OUString aFullName = u"export/" + aRecommendedName;
+OUString aBaseName;
+OUString aExtension;
+sal_Int32 nPos = aFullName.lastIndexOf( '.' );
+if ( nPos >= 0 )
+{
+aBaseName = aFullName.copy(0, nPos);
+aExtension = aFullName.copy(nPos, aFullName.getLength() - 
nPos);
+}
+aURL = INetURLObject(::utl::CreateTempURL( aBaseName, false, 
aExtension, nullptr, true));
+
+// Remove any stale files left from a previous export
+OUString fileURL = 
aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+if (!fileURL.isEmpty())
+osl::File::remove(fileURL);
+}
+else
+{
+#endif
+// keep name with extension
+aSuggestedName = aRecommendedName;
+OUString aExtension;
+if (size_t nPos = aSuggestedName.lastIndexOf('.') + 1)
+aExtension = aSuggestedName.copy(nPos, 
aSuggestedName.getLength() - nPos);
+aURL.SetExtension(aExtension);
+#ifdef IOS
+}
+#endif
 }
 else
 {
@@ -1822,10 +1858,22 @@ bool 
SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
 
 // this is actually a save operation with different parameters
 // so storeTo or storeAs without DocInfo operations are used
-if ( nStoreMode & EXPORT_REQUESTED )
-

core.git: Branch 'libreoffice-24-2-0' - vcl/source

2024-01-14 Thread Patrick Luby (via logerrit)
 vcl/source/app/salvtables.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit a93cd8a7e9704617d82db2d421154de3ff92
Author: Patrick Luby 
AuthorDate: Wed Jan 10 19:30:17 2024 -0500
Commit: Patrick Luby 
CommitDate: Sun Jan 14 23:20:26 2024 +0100

tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`

rather than waiting for `m_xDrawingArea` to get disposed, to prevent
unsafe use of the now potentially non-functional accessible until it
gets disposed with the VclDrawingArea

Change-Id: I5b8720ac4d5ed41cb1775b0142b17d198e9f036d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161903
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 244bd399732017615bab2c34c2b29d6a80d27ae9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162007
Reviewed-by: Michael Weghorn 
Tested-by: Patrick Luby 

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 17e6435c3fc2..95beb907f6c0 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6340,6 +6340,19 @@ SalInstanceDrawingArea::~SalInstanceDrawingArea()
 m_xDrawingArea->SetResizeHdl(Link());
 m_xDrawingArea->SetPaintHdl(
 Link, void>());
+
+// tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`
+// rather than waiting for `m_xDrawingArea` to get disposed, to prevent
+// unsafe use of the now potentially non-functional accessible until it
+// gets disposed with the VclDrawingArea
+css::uno::Reference xAccessible
+= m_xDrawingArea->GetAccessible();
+css::uno::Reference xComp(xAccessible, 
css::uno::UNO_QUERY);
+if (xComp.is())
+{
+xComp->dispose();
+m_xDrawingArea->SetAccessible(nullptr);
+}
 }
 
 OutputDevice& SalInstanceDrawingArea::get_ref_device() { return 
*m_xDrawingArea->GetOutDev(); }


core.git: Branch 'libreoffice-24-2' - vcl/source

2024-01-14 Thread Patrick Luby (via logerrit)
 vcl/source/app/salvtables.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit 753981dd0cbbdedeca4fa95681f6d65d370a758f
Author: Patrick Luby 
AuthorDate: Wed Jan 10 19:30:17 2024 -0500
Commit: Michael Weghorn 
CommitDate: Sun Jan 14 20:22:24 2024 +0100

tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`

rather than waiting for `m_xDrawingArea` to get disposed, to prevent
unsafe use of the now potentially non-functional accessible until it
gets disposed with the VclDrawingArea

Change-Id: I5b8720ac4d5ed41cb1775b0142b17d198e9f036d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161903
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 244bd399732017615bab2c34c2b29d6a80d27ae9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162006
Reviewed-by: Michael Weghorn 

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 17e6435c3fc2..95beb907f6c0 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6340,6 +6340,19 @@ SalInstanceDrawingArea::~SalInstanceDrawingArea()
 m_xDrawingArea->SetResizeHdl(Link());
 m_xDrawingArea->SetPaintHdl(
 Link, void>());
+
+// tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`
+// rather than waiting for `m_xDrawingArea` to get disposed, to prevent
+// unsafe use of the now potentially non-functional accessible until it
+// gets disposed with the VclDrawingArea
+css::uno::Reference xAccessible
+= m_xDrawingArea->GetAccessible();
+css::uno::Reference xComp(xAccessible, 
css::uno::UNO_QUERY);
+if (xComp.is())
+{
+xComp->dispose();
+m_xDrawingArea->SetAccessible(nullptr);
+}
 }
 
 OutputDevice& SalInstanceDrawingArea::get_ref_device() { return 
*m_xDrawingArea->GetOutDev(); }


core.git: vcl/source

2024-01-14 Thread Patrick Luby (via logerrit)
 vcl/source/app/salvtables.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit 563f7077f1dbce31ff95ee8d2e8d17b629693db1
Author: Patrick Luby 
AuthorDate: Wed Jan 10 19:30:17 2024 -0500
Commit: Patrick Luby 
CommitDate: Sun Jan 14 12:52:16 2024 +0100

tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`

rather than waiting for `m_xDrawingArea` to get disposed, to prevent
unsafe use of the now potentially non-functional accessible until it
gets disposed with the VclDrawingArea

Change-Id: I5b8720ac4d5ed41cb1775b0142b17d198e9f036d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161903
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index bf76517fea68..7482a086b1be 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6340,6 +6340,19 @@ SalInstanceDrawingArea::~SalInstanceDrawingArea()
 m_xDrawingArea->SetResizeHdl(Link());
 m_xDrawingArea->SetPaintHdl(
 Link, void>());
+
+// tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`
+// rather than waiting for `m_xDrawingArea` to get disposed, to prevent
+// unsafe use of the now potentially non-functional accessible until it
+// gets disposed with the VclDrawingArea
+css::uno::Reference xAccessible
+= m_xDrawingArea->GetAccessible();
+css::uno::Reference xComp(xAccessible, 
css::uno::UNO_QUERY);
+if (xComp.is())
+{
+xComp->dispose();
+m_xDrawingArea->SetAccessible(nullptr);
+}
 }
 
 OutputDevice& SalInstanceDrawingArea::get_ref_device() { return 
*m_xDrawingArea->GetOutDev(); }


core.git: Branch 'distro/collabora/co-23.05' - distro-configs/CPiOSBranding.conf distro-configs/LibreOfficeiOS.conf distro-configs/LibreOfficeiOS_Sim.conf sfx2/source

2024-01-10 Thread Patrick Luby (via logerrit)
 distro-configs/CPiOSBranding.conf  |3 -
 distro-configs/LibreOfficeiOS.conf |3 -
 distro-configs/LibreOfficeiOS_Sim.conf |3 -
 sfx2/source/doc/guisaveas.cxx  |   68 -
 4 files changed, 64 insertions(+), 13 deletions(-)

New commits:
commit 30ebff71a89fa705d0a04b11026685ac1f666edf
Author: Patrick Luby 
AuthorDate: Fri Jan 5 09:55:26 2024 -0500
Commit: Andras Timar 
CommitDate: Wed Jan 10 14:34:34 2024 +0100

Eliminate hang in iOS app (and maybe the Android app) during export

When exporting a document via this path, such as exporting to PDF
via the .uno:ExportToPDF command, any exceptions thrown while saving
the current document will leave the app in a blocked state if a
"PENDING" message has been sent.

The iOS app (and maybe the Android app) fails to set the URL to
save to so we need to set it to a temporary file.
Note: the iOS app is responsible for deleting the temporary file.

Also, enable building iOS with TLS=OPENSSL by default.

Signed-off-by: Patrick Luby 
Change-Id: Ibc070bed4e792bb0a481d2b900d12d214e3c519f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161692
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/distro-configs/CPiOSBranding.conf 
b/distro-configs/CPiOSBranding.conf
index 8ce87bddeec0..66dd14357238 100644
--- a/distro-configs/CPiOSBranding.conf
+++ b/distro-configs/CPiOSBranding.conf
@@ -24,7 +24,8 @@
 --disable-poppler
 --disable-python
 
---without-tls
+# OpenSSL is the default
+#--with-tls=openssl
 
 # iOS device
 --host=arm64-apple-ios
diff --git a/distro-configs/LibreOfficeiOS.conf 
b/distro-configs/LibreOfficeiOS.conf
index c0ba243ab840..ab36e05ba668 100644
--- a/distro-configs/LibreOfficeiOS.conf
+++ b/distro-configs/LibreOfficeiOS.conf
@@ -24,7 +24,8 @@
 --disable-poppler
 --disable-python
 
---without-tls
+# OpenSSL is the default
+#--with-tls=openssl
 
 # iOS device
 --host=arm64-apple-ios
diff --git a/distro-configs/LibreOfficeiOS_Sim.conf 
b/distro-configs/LibreOfficeiOS_Sim.conf
index c121a29a9879..03558256657a 100644
--- a/distro-configs/LibreOfficeiOS_Sim.conf
+++ b/distro-configs/LibreOfficeiOS_Sim.conf
@@ -24,7 +24,8 @@
 --disable-poppler
 --disable-python
 
---without-tls
+# OpenSSL is the default
+#--with-tls=openssl
 
 # iOS simulator (debug)
 --enable-ios-simulator
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 1e525301d03a..2ad61ea33c00 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1099,12 +1099,48 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 
nStoreMode,
 
 if (comphelper::LibreOfficeKit::isActive())
 {
-// keep name with extension
-aSuggestedName = aRecommendedName;
-OUString aExtension;
-if (size_t nPos = aSuggestedName.lastIndexOf('.') + 1)
-aExtension = aSuggestedName.copy(nPos, aSuggestedName.getLength() 
- nPos);
-aURL.SetExtension(aExtension);
+#ifdef IOS
+// The iOS app (and maybe the Android app) have fails to set the URL to
+// save to so we need to set it to a temporary file.
+// Note: the iOS app is responsible for deleting the temporary file.
+if (nStoreMode & EXPORT_REQUESTED && 
aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE).isEmpty())
+{
+// Mirror the "export/docbasename.pdf" path format to match the
+// format used in the "downloadas" message handler in the iOS app's
+// -[DocumentViewController 
userContentController:didReceiveScriptMessage]
+// selector.
+// Important note: temporary files created here must be in their
+// own subdirectory since the iOS app's UIDocumentPickerDelegate
+// will try to delete both the temporary file and its parent
+// directory.
+OUString aFullName = u"export/" + aRecommendedName;
+OUString aBaseName;
+OUString aExtension;
+sal_Int32 nPos = aFullName.lastIndexOf( '.' );
+if ( nPos >= 0 )
+{
+aBaseName = aFullName.copy(0, nPos);
+aExtension = aFullName.copy(nPos, aFullName.getLength() - 
nPos);
+}
+aURL = INetURLObject(::utl::CreateTempURL( aBaseName, false, 
aExtension, nullptr, true));
+
+// Remove any stale files left from a previous export
+OUString fileURL = 
aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+if (!fileURL.isEmpty())
+osl::File::remove(fileURL);
+}
+else
+{
+#endif
+// keep name with extension
+aSuggestedName = aRecommendedName;
+OUString aExtension;
+if (size_t nPos = aSuggestedName.lastIndexOf('.') + 1)
+aExtension = aSuggestedName.copy(nPos, 
aSuggestedName.getLength() - 

core.git: Branch 'libreoffice-7-6' - sc/source vcl/osx

2024-01-05 Thread Patrick Luby (via logerrit)
 sc/source/ui/inc/tabview.hxx  |2 +
 sc/source/ui/view/tabview.cxx |   46 ++
 vcl/osx/salframeview.mm   |8 +++
 3 files changed, 52 insertions(+), 4 deletions(-)

New commits:
commit 48c13e2cefb0251d9ca975f4e4f39af3d8adec6f
Author: Patrick Luby 
AuthorDate: Mon Dec 25 09:19:48 2023 -0500
Commit: Caolán McNamara 
CommitDate: Fri Jan 5 15:59:57 2024 +0100

tdf#135478 Reduce sensitivity of horizontal scrollwheel

Problem: at least on macOS, swipe events are very
precise. So, when swiping at a slight angle off of
vertical, swipe events will include a small amount
of horizontal movement. Since horizontal swipe units
are measured in cell widths, these small amounts of
horizontal movement results in shifting many columns
to the right or left while swiping almost vertically.

So my hacky fix is to reduce the amount of horizontal
swipe events to roughly match the "visual distance"
of vertical swipe events.

The reduction factor is arbitrary but is set to
roughly the ratio of default cell width divided by
default cell height. This hacky fix isn't a perfect
fix, but hopefully it reduces the amount of
unexpected horizontal shifting while swiping
vertically to a tolerable amount for most users.

Note: the potential downside of doing this is that
some users might find horizontal swiping to be
slower than they are used to. If that becomes an
issue for enough users, the reduction factor may
need to be lowered to find a good balance point.

Lastly, fix the unbalanced rounding of delta X and Y
values due to using floor() for macOS native swipe
and scroll wheel events.

Change-Id: I8c0c9a3aa688e411c47ebb5e7500f3a50f6f673b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161278
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Patrick Luby 
(cherry picked from commit 689ddab27bb0658e43ab0e0d4d8235e45d8904d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161318
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 3f270770ec89..eb62660f2a28 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -216,6 +216,8 @@ private:
 
 double  mfLastZoomScale = 0;
 double  mfAccumulatedZoom = 0;
+tools::Long mnPendingaHScrollLeftDelta = 0;
+tools::Long mnPendingaHScrollRightDelta = 0;
 
 voidInit();
 
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index aa5bd477a15b..6ead63b98d85 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1216,6 +1216,52 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll)
 else
 nDelta = 0;
 }
+else if ( bHoriz )
+{
+// tdf#135478 Reduce sensitivity of horizontal scrollwheel
+// Problem: at least on macOS, swipe events are very
+// precise. So, when swiping at a slight angle off of
+// vertical, swipe events will include a small amount
+// of horizontal movement. Since horizontal swipe units
+// are measured in cell widths, these small amounts of
+// horizontal movement results in shifting many columns
+// to the right or left while swiping almost vertically.
+// So my hacky fix is to reduce the amount of horizontal
+// swipe events to roughly match the "visual distance"
+// of vertical swipe events.
+// The reduction factor is arbitrary but is set to
+// roughly the ratio of default cell width divided by
+// default cell height. This hacky fix isn't a perfect
+// fix, but hopefully it reduces the amount of
+// unexpected horizontal shifting while swiping
+// vertically to a tolerable amount for most users.
+// Note: the potential downside of doing this is that
+// some users might find horizontal swiping to be
+// slower than they are used to. If that becomes an
+// issue for enough users, the reduction factor may
+// need to be lowered to find a good balance point.
+static const sal_uInt16 nHScrollReductionFactor = 8;
+if ( pScroll == aHScrollLeft.get() )
+{
+mnPendingaHScrollLeftDelta += nDelta;
+nDelta = 0;
+if ( abs(mnPendingaHScrollLeftDelta) > 
nHScrollReductionFactor )
+{
+ 

core.git: Branch 'libreoffice-24-2' - sc/source vcl/osx

2024-01-05 Thread Patrick Luby (via logerrit)
 sc/source/ui/inc/tabview.hxx  |2 +
 sc/source/ui/view/tabview.cxx |   46 ++
 vcl/osx/salframeview.mm   |8 +++
 3 files changed, 52 insertions(+), 4 deletions(-)

New commits:
commit 24effe0edd9ae1ea9e4dd8e0bdabd5f25e1b9a68
Author: Patrick Luby 
AuthorDate: Mon Dec 25 09:19:48 2023 -0500
Commit: Caolán McNamara 
CommitDate: Fri Jan 5 15:48:41 2024 +0100

tdf#135478 Reduce sensitivity of horizontal scrollwheel

Problem: at least on macOS, swipe events are very
precise. So, when swiping at a slight angle off of
vertical, swipe events will include a small amount
of horizontal movement. Since horizontal swipe units
are measured in cell widths, these small amounts of
horizontal movement results in shifting many columns
to the right or left while swiping almost vertically.

So my hacky fix is to reduce the amount of horizontal
swipe events to roughly match the "visual distance"
of vertical swipe events.

The reduction factor is arbitrary but is set to
roughly the ratio of default cell width divided by
default cell height. This hacky fix isn't a perfect
fix, but hopefully it reduces the amount of
unexpected horizontal shifting while swiping
vertically to a tolerable amount for most users.

Note: the potential downside of doing this is that
some users might find horizontal swiping to be
slower than they are used to. If that becomes an
issue for enough users, the reduction factor may
need to be lowered to find a good balance point.

Lastly, fix the unbalanced rounding of delta X and Y
values due to using floor() for macOS native swipe
and scroll wheel events.

Change-Id: I8c0c9a3aa688e411c47ebb5e7500f3a50f6f673b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161278
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Patrick Luby 
(cherry picked from commit 689ddab27bb0658e43ab0e0d4d8235e45d8904d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161317
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 23419f463923..66bbc010eae1 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -217,6 +217,8 @@ private:
 
 double  mfLastZoomScale = 0;
 double  mfAccumulatedZoom = 0;
+tools::Long mnPendingaHScrollLeftDelta = 0;
+tools::Long mnPendingaHScrollRightDelta = 0;
 
 voidInit();
 
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index fd9e88d18f31..9eff50195e84 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1217,6 +1217,52 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll)
 else
 nDelta = 0;
 }
+else if ( bHoriz )
+{
+// tdf#135478 Reduce sensitivity of horizontal scrollwheel
+// Problem: at least on macOS, swipe events are very
+// precise. So, when swiping at a slight angle off of
+// vertical, swipe events will include a small amount
+// of horizontal movement. Since horizontal swipe units
+// are measured in cell widths, these small amounts of
+// horizontal movement results in shifting many columns
+// to the right or left while swiping almost vertically.
+// So my hacky fix is to reduce the amount of horizontal
+// swipe events to roughly match the "visual distance"
+// of vertical swipe events.
+// The reduction factor is arbitrary but is set to
+// roughly the ratio of default cell width divided by
+// default cell height. This hacky fix isn't a perfect
+// fix, but hopefully it reduces the amount of
+// unexpected horizontal shifting while swiping
+// vertically to a tolerable amount for most users.
+// Note: the potential downside of doing this is that
+// some users might find horizontal swiping to be
+// slower than they are used to. If that becomes an
+// issue for enough users, the reduction factor may
+// need to be lowered to find a good balance point.
+static const sal_uInt16 nHScrollReductionFactor = 8;
+if ( pScroll == aHScrollLeft.get() )
+{
+mnPendingaHScrollLeftDelta += nDelta;
+nDelta = 0;
+if ( abs(mnPendingaHScrollLeftDelta) > 
nHScrollReductionFactor )
+{
+ 

core.git: Branch 'libreoffice-7-6' - vcl/osx

2024-01-04 Thread Patrick Luby (via logerrit)
 vcl/osx/salinst.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit 4509eb097d82b84423f8cbba3c9915a9fbe6f691
Author: Patrick Luby 
AuthorDate: Wed Dec 20 09:32:06 2023 -0500
Commit: Caolán McNamara 
CommitDate: Thu Jan 4 18:03:51 2024 +0100

Related: tdf#155266 stop delaying painting timer while swiping

After fixing several flushing issues in tdf#155266, scrollbars
still will not redraw until swiping has ended or paused when
using Skia/Raster or Skia disabled. So, stop the delay by only
including NSEventMaskScrollWheel if the current event type is
not NSEventTypeScrollWheel.

Change-Id: I9348e5a38b4d0fedbf424b92a71eed25280fc21f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161075
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 9f92a39234dfae40fe19ab6fa47caf8b21dd8847)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161103
Reviewed-by: Caolán McNamara 

diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index d7b85b1c23f6..6946f11c143e 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -726,6 +726,7 @@ bool AquaSalInstance::AnyInput( VclInputFlags nType )
 
 unsigned/*NSUInteger*/ nEventMask = 0;
 if( nType & VclInputFlags::MOUSE)
+{
 nEventMask |=
 NSEventMaskLeftMouseDown| NSEventMaskRightMouseDown| 
NSEventMaskOtherMouseDown|
 NSEventMaskLeftMouseUp  | NSEventMaskRightMouseUp  | 
NSEventMaskOtherMouseUp  |
@@ -733,6 +734,18 @@ bool AquaSalInstance::AnyInput( VclInputFlags nType )
 NSEventMaskScrollWheel  |
 // NSEventMaskMouseMoved|
 NSEventMaskMouseEntered | NSEventMaskMouseExited;
+
+// Related: tdf#155266 stop delaying painting timer while swiping
+// After fixing several flushing issues in tdf#155266, scrollbars
+// still will not redraw until swiping has ended or paused when
+// using Skia/Raster or Skia disabled. So, stop the delay by only
+// including NSEventMaskScrollWheel if the current event type is
+// not NSEventTypeScrollWheel.
+NSEvent* pCurrentEvent = [NSApp currentEvent];
+if( pCurrentEvent && [pCurrentEvent type] == NSEventTypeScrollWheel )
+nEventMask &= ~NSEventMaskScrollWheel;
+}
+
 if( nType & VclInputFlags::KEYBOARD)
 nEventMask |= NSEventMaskKeyDown | NSEventMaskKeyUp | 
NSEventMaskFlagsChanged;
 if( nType & VclInputFlags::OTHER)


core.git: Branch 'libreoffice-7-6' - drawinglayer/source

2023-12-29 Thread Patrick Luby (via logerrit)
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |   18 +++
 1 file changed, 18 insertions(+)

New commits:
commit 744aaf0d068505fdbf4dcc66eabaf495cdd4fcb3
Author: Patrick Luby 
AuthorDate: Sat Dec 23 09:35:06 2023 -0500
Commit: Caolán McNamara 
CommitDate: Fri Dec 29 12:43:15 2023 +0100

Related: tdf#158807 mutex must be locked when disposing a VirtualDevice

If the following .ppt document is opened in a debug build
and the document is left open for a minute or two without
changing any content, this destructor will be called on a
non-main thread with the mutex unlocked:

  https://bugs.documentfoundation.org/attachment.cgi?id=46801

This hits an assert in VirtualDevice::ReleaseGraphics() so
explicitly lock the mutex and explicitly dispose and clear
the VirtualDevice instances variables.

Change-Id: I5d371a4e99fca4aae2b6edc8b53eca10cb143aef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161243
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
(cherry picked from commit 0f8ad0f55e118f1f016b250de0c7940c7e21062a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161219
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index 8e0c8a980f33..ad4c8a28c915 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -344,6 +344,7 @@ namespace drawinglayer::primitive2d
 AnimatedGraphicPrimitive2D(
 const Graphic& rGraphic,
 basegfx::B2DHomMatrix aTransform);
+virtual ~AnimatedGraphicPrimitive2D();
 
 /// data read access
 const basegfx::B2DHomMatrix& getTransform() const { return 
maTransform; }
@@ -407,6 +408,23 @@ namespace drawinglayer::primitive2d
 }
 }
 
+AnimatedGraphicPrimitive2D::~AnimatedGraphicPrimitive2D()
+{
+// Related: tdf#158807 mutex must be locked when disposing a 
VirtualDevice
+// If the following .ppt document is opened in a debug build
+// and the document is left open for a minute or two without
+// changing any content, this destructor will be called on a
+// non-main thread with the mutex unlocked:
+//   https://bugs.documentfoundation.org/attachment.cgi?id=46801
+// This hits an assert in VirtualDevice::ReleaseGraphics() so
+// explicitly lock the mutex and explicitly dispose and clear
+// the VirtualDevice instances variables.
+const SolarMutexGuard aSolarGuard;
+
+maVirtualDevice.disposeAndClear();
+maVirtualDeviceMask.disposeAndClear();
+}
+
 bool AnimatedGraphicPrimitive2D::operator==(const BasePrimitive2D& 
rPrimitive) const
 {
 // do not use 'GroupPrimitive2D::operator==' here, that would 
compare


  1   2   3   4   >