https://bugs.documentfoundation.org/show_bug.cgi?id=145285

Julien Nabet <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected],
                   |                            |[email protected],
                   |                            |[email protected]

--- Comment #8 from Julien Nabet <[email protected]> ---
Jon: do you reproduce this with a brand new odg file containing just "test"?
If no, would it be possible you attach an example file? (of course don't forget
to sanitize it if needed, see
https://wiki.documentfoundation.org/QA/Bugzilla/Sanitizing_Files_Before_Submission)


Anyway, both crash dumps show a lot of calls to
FilterHelper::filenameMatchesFilter

Taking a look at it, I see:
    317 bool FilterHelper::filenameMatchesFilter(NSString* sFilename)
    318 {
...
    355     // might be an alias
    356     NSString* pResolved = resolveAlias( sFilename );
    357     if( pResolved )
    358     {
    359         bool bResult = filenameMatchesFilter( pResolved );
    360         [pResolved autorelease];
    361         if( bResult )
    362             return true;
    363     }
    364 
    365     return false;
    366 }

(https://opengrok.libreoffice.org/xref/core/fpicker/source/aqua/FilterHelper.mm?r=33d5c024&mo=8332&fi=317#317)

So it seems this recursive function is never ending.

So either it could be explained by the result of pResolved being identical to
sFilename and we could avoid this situation with:
diff --git a/fpicker/source/aqua/FilterHelper.mm
b/fpicker/source/aqua/FilterHelper.mm
index 58508c434191..43d598f5a320 100644
--- a/fpicker/source/aqua/FilterHelper.mm
+++ b/fpicker/source/aqua/FilterHelper.mm
@@ -356,6 +356,8 @@ bool FilterHelper::filenameMatchesFilter(NSString*
sFilename)
     NSString* pResolved = resolveAlias( sFilename );
     if( pResolved )
     {
+        if (pResolved == sFilename)
+            return false; // or true ?
         bool bResult = filenameMatchesFilter( pResolved );
         [pResolved autorelease];
         if( bResult )

or it can be a bit less simple with
resolveAlias(A) => B (not null)
resolveAlias(B) => A
etc.
or with more values.
(I don't know if it could be possible)
so in this case we may put a kind of guard to limit the number of recursions.


Remark: I noticed that the only caller of "filenameMatchesFilter" was:
     43 #pragma mark NSSavePanel delegate methods
     44 
     45 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
     46 {
     47     (void)sender;
     48     if( filterHelper == nullptr )
     49         return true;
     50     if( filename == nil )
     51         return false;
     52     return filterHelper->filenameMatchesFilter(filename);
     53 }
(see
https://opengrok.libreoffice.org/xref/core/fpicker/source/aqua/AquaFilePickerDelegate.mm?r=cd3c315e#45)

Searching about "shouldShowFilename", it's indicated as deprecated (as some
other MacOs methods used by LO) and should be replaced by
panel:shouldEnableURL: (NSOpenSavePanelDelegate).(see
https://developer.apple.com/documentation/objectivec/nsobject/1539030-panel)
Now perhaps it doesn't change anything but just wonder if we really need to
override by default behaviour. If we don't need to override, we may just remove
this part.


Since I don't have a Mac, I'm just trying to understand the code without the
possibility to test anything here.

Tor/Stephan: any thoughts here?
(of course, if no time/not interested/whatever, don't hesitate to uncc
yourself! :-))

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to