Bug 57836 - Basic IDE: crashes after starting script (::com::sun::star::frame:: interface XStorable method store() ) [bt with symbols attached]
Summary: Basic IDE: crashes after starting script (::com::sun::star::frame:: interface...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.4.2 release
Hardware: Other All
: medium normal
Assignee: Noel Power
URL:
Whiteboard: target:4.0.0 target:3.6.5
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-03 12:09 UTC by sasha.libreoffice
Modified: 2013-01-04 06:12 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
document with macro that causes crash (13.52 KB, application/vnd.oasis.opendocument.text)
2012-12-03 12:09 UTC, sasha.libreoffice
Details
bt with symbols, produced in self-compiled 3.6.2 on RFR 17 64 bit (36.00 KB, text/plain)
2012-12-03 12:14 UTC, sasha.libreoffice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sasha.libreoffice 2012-12-03 12:09:57 UTC
Created attachment 70965 [details]
document with macro that causes crash

Basic Crash.
This macro saves opened document. At least intended to do this.
Used UNO function :: com::sun::star::frame:: interface XStorable method store()

Close all documents before experiment

Steps to reproduce:
1. Press Alt-F11, select macro from this document, press “Edit”
2. in Basic IDE press F5 to start macro

Actually: LO crashes
Expected: anything, but not crash

reproduced in 3.4.2 and 3.5.0 on Windows XP 32 bit
in 3.5.7 and 3.6.3 on RFR 17 64 bit
Comment 1 sasha.libreoffice 2012-12-03 12:14:32 UTC
Created attachment 70966 [details]
bt with symbols, produced in self-compiled 3.6.2 on RFR 17 64 bit
Comment 2 Julien Nabet 2012-12-03 22:06:12 UTC
On pc Debian x86-64 with master sources updated today (commit 8b568c1dd472021ebeb9d1536a8aab7e0b286074), I reproduced the crash.

Even if I put an if (rMedium.GetFilter()) before this line:
1301         long nFormat = rMedium.GetFilter()->GetFormat();
until end of if (pFilt) line 1325, it's not sufficient.
I got :
#0  0x00007f9fed5f2f00 in SfxFilter::GetFilterFlags (this=0x0) at /home/julien/compile-libreoffice/libo/sfx2/inc/sfx2/docfilt.hxx:77
#1  0x00007f9fed8ad127 in SfxObjectShell::SaveTo_Impl (this=0x5939580, rMedium=..., pSet=0x61b51d0) at /home/julien/compile-libreoffice/libo/sfx2/source/doc/objstor.cxx:1344

if( bOwnTarget && !( (pFilter && pFilter->GetFilterFlags()) & SFX_FILTER_STARONEFILTER ) )
pFilter is (0x0)

quotation's Markus:
what I could imagine is that the problem is that the BAsicIDE has no filters attached
Comment 3 Noel Power 2012-12-04 10:16:25 UTC
(In reply to comment #2)
> On pc Debian x86-64 with master sources updated today (commit
> 8b568c1dd472021ebeb9d1536a8aab7e0b286074), I reproduced the crash.
> 
> Even if I put an if (rMedium.GetFilter()) before this line:
> 1301         long nFormat = rMedium.GetFilter()->GetFormat();
> until end of if (pFilt) line 1325, it's not sufficient.
> I got :
> #0  0x00007f9fed5f2f00 in SfxFilter::GetFilterFlags (this=0x0) at
> /home/julien/compile-libreoffice/libo/sfx2/inc/sfx2/docfilt.hxx:77
> #1  0x00007f9fed8ad127 in SfxObjectShell::SaveTo_Impl (this=0x5939580,
> rMedium=..., pSet=0x61b51d0) at
> /home/julien/compile-libreoffice/libo/sfx2/source/doc/objstor.cxx:1344
> 
> if( bOwnTarget && !( (pFilter && pFilter->GetFilterFlags()) &
> SFX_FILTER_STARONEFILTER ) )
> pFilter is (0x0)
> 
> quotation's Markus:
> what I could imagine is that the problem is that the BAsicIDE has no filters
> attached

I presume ( I didn't get a chance to run the macro itself yet... rebuilding for something else ) that what is happening is that the macro here is trying to do something stupid, i.e. it's trying to store its model, if that is the case then like Markus says then there would be no filter found for the IDE for sure and that triggers the pain you see.
So, while this is kindof unfortunate it's probably fairly unlikely to occur often or even at all in real life, but... crashing is not nice anytime. I guess we should at the least throw an exception when trying to store the basic IDE model that would seem to be the easiest solution. It is however still a little disturbing that failure to find a filter doesn't get handled but perhaps this is regarded as somewhat impossible ( i.e. a model doesn't know how to store itself ) given the rats nest that sfx2 is it might be easier to just throw for the specific basic ide model ( that is if there is one, I don't recall ever even seeing where the ide model was :-) )
Comment 4 Noel Power 2012-12-04 10:58:29 UTC
added a fix for this to master, should work, if another solution is forthcoming then we could revert it
Comment 5 Not Assigned 2012-12-04 11:01:36 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ab96b65e0d4fab541d8b31b46e3f37db0fb548b5

fix for fdo#57836 throw when attempting to store basicide model



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 6 sasha.libreoffice 2012-12-04 11:07:03 UTC
Thanks for fixing this bug
Comment 7 LeMoyne Castle 2012-12-22 05:00:40 UTC
Exception thrown and message displayed when macro tried in Version 3.6.3.2 (Build ID: 58f22d5).  

Error message is missing - dialog contains: 

BASIC runtime error.
An exception occurred
Type: com.sun.star.task.ErrorCodeIOException
Message: .  

The difference between the crash (x86-64) and a blank exception (x86-32b) is likely the 32b/64b difference. 

Verified the fix in a build from master 12/20: the message 'Can't store IDE model.' comes through with type...io.IOException.  I am not on a 64bit system and could not re-create the crash so not marking resolved.
Comment 8 Noel Power 2013-01-03 15:50:11 UTC
marking as fixed ( independently confirmed on 32 bit ) and additionally 64 bit here. Also fix is up for review to be backported to 3.6
Comment 9 Not Assigned 2013-01-04 06:12:08 UTC
Noel Power committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=37eea402ed3b8b401c8eca841ca65c997994be90&h=libreoffice-3-6

fix for fdo#57836 throw when attempting to store basicide model


It will be available in LibreOffice 3.6.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.