Issue 29256 - OOo crashes when executing macro
Summary: OOo crashes when executing macro
Status: CLOSED WONT_FIX
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows 2000
: P3 Trivial
Target Milestone: ---
Assignee: huvo
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-17 10:59 UTC by huvo
Modified: 2013-02-24 21:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description huvo 2004-05-17 10:59:33 UTC
Hi!

I've got this macro:

    Sub Main
                ' normally here are some other instructions,
                ' so please don't ask:
                ' "Why should a macro only close this document?"
		ThisComponent.close(false)
    End Sub

If I execute it, it does what I want:
The document containing the macro closes.

But if i assign it to the event "Open Document" and open the document,
I get the following message box and OOo totally crashes:

Title: Microsoft Visual C++ Runtime Library
Text:  Runtime Error!
       Program: C:\programme\openoffice680\program\soffice.exe
       abnormal program termination.

Bye,
Dominik Di Lorenzo
Hugo Vogelsang GmbH & Co KG
Comment 1 stephan.wunderlich 2004-05-17 11:38:50 UTC
SW->AS: it crashes indeed and I set the target to OOo2.0 since OOo1.1.1 doesn't
crash ... seems something got broken on the way
Comment 2 andreas.schluens 2004-05-19 09:15:40 UTC
Its fixed ... for the moment! But nobody can guarantee, that it will work
tomorrow too. The reason: You close the document during(!) it was tried to be
loaded. Because this event is called before loading is realy finished.

The question is: is it usefull to close documents automaticly during loading ..?
Please specify your requirements. May we find another (not so strange!) solution
for you.
Comment 3 huvo 2004-05-19 09:48:51 UTC
Hi!

>Please specify your requirements. 
>May we find another (not so strange!) solution for you.
Thanks for your offer.

My problem:
We're a company in the cold rolled steel industry.
We've got some old COBOL programs running here.
To get the data from those programs to OOo Calc, 
we do this:

- make a CSV file in the COBOL program
- call OOo from the COBOL program with "soffice f:\public\macro123.sxw"
- those Writer-Files contain BASIC-macros that import the CSV Files with the
  correct character set, and (with help of templates) create a beautiful
  formated new "untitled1" calc document.
- then the writer file (containing the macro) closes itself 
   (and this is, where it crashed since OOo680)

Ciao,
Dominik Di Lorenzo 
dilorenzo@vogelsang-bandstahl.de
Hugo Vogelsang GmbH & Co KG
Comment 4 andreas.schluens 2004-05-25 09:19:54 UTC
.
Comment 5 andreas.schluens 2004-06-02 13:37:15 UTC
.
Comment 6 andreas.schluens 2004-06-02 13:37:51 UTC
AS->SW: Please verify it on my cws again. THX.
Comment 7 andreas.schluens 2004-06-02 13:38:10 UTC
.
Comment 8 stephan.wunderlich 2004-06-03 10:30:43 UTC
SW->AS: can't see any changes in fwk02ea the office still crashes :-(
Comment 9 stephan.wunderlich 2004-06-03 10:31:22 UTC
reassigned 
Comment 10 andreas.schluens 2004-06-03 12:34:21 UTC
Hello Dominik!

I've tried it ... but this task cant be realy fixed. Because this event is sent
during loading of the document. If you close it, EVERY line of code inside our
office must be aware to be killed! That would mean: we must implement a
transaction handling ... which isnt realy possible without rewriting 100% of our
code :-(

From our point of view (and after reading your requirements) we say: dont do it
in this way.
But how can you do your job then?

1) You can implement a basic macro, which converts your CSV files via API.
2) Put it into the global basic container (not into the document).
3) Start your office with a macro-URL, which triggers the macro.
4) The macro itself does the following:

sub startCSVConvertion
  on error goto HANDLE_ERROR

  doc = StarDesktop.loadComponentFromURL(...)
  convertCSV(doc)
  doc.close(false)

  rem Finish this job without an explicit office shutdown!
  exit sub

HANDLE_ERROR:
  msgbox "Closing of document failed."
end sub

Regards
Andreas

PS: Fell free to ask me for further details by an email sent to as@openoffice.org!
Comment 11 andreas.schluens 2004-06-03 12:34:53 UTC
.
Comment 12 andreas.schluens 2004-06-03 12:35:22 UTC
Send it back to you.
Comment 13 thorsten.ziehm 2004-11-10 15:13:34 UTC
Hello Dominik,

please evaluate, if you can live with the workaround. If you can live with it,
please close the task.
I retarget this task to 'OOo later'. 
Comment 14 thorsten.ziehm 2004-11-12 13:01:31 UTC
After a discussion with Dominik, I close this task.