Bug 72156 - insertByName locks inserted file
Summary: insertByName locks inserted file
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
4.1.3.2 release
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: ulkitz
URL:
Whiteboard: target:4.3.0 target:4.2.0.1 target:4.1.4
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-29 14:46 UTC by ulkitz
Modified: 2013-12-09 16:51 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sample file with one image and short macro. (19.36 KB, application/vnd.oasis.opendocument.presentation)
2013-11-29 14:46 UTC, ulkitz
Details
Added delete statement (1004 bytes, patch)
2013-11-30 20:48 UTC, ulkitz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ulkitz 2013-11-29 14:46:05 UTC
Created attachment 89998 [details]
Sample file with one image and short macro.

Suppose you have an Impress presentation and want to export the images and import then again into a writer document.
When your macro first exports the images and then calls bitmaps.insertByName("myTempName", fileurl) the inserted file remains locked on Windows 7, so it cannot be removed (for cleanup) by the macro via kill(filename). 
I attach a sample presentation with one image. The macro may be started via Tools -> Macro -> Run, ExportTest.odp->Standard->Module1. It first exports the image into your "tmp"-directory, creates a new writer document, and inserts the exported image into that document. After the image was imported, you may switch to the Windows explorer and try to remove the image file by hand, and Windows tells you (translated, so the real english text may differ) "The file cannot be deleted because it is still in use by LibreOffice". 
The file remains locked until Libreoffice, including the QuickStart menu entry, is closed.
Comment 1 ulkitz 2013-11-30 20:48:12 UTC
Created attachment 90042 [details]
Added delete statement
Comment 2 Michael Stahl (allotropia) 2013-12-04 12:19:37 UTC
hi Ulrich,

that definitely looks like a memory leak (in addition to the Windows locking problem), thanks for finding it.

can you please send a license mail to  libreoffice@lists.freedesktop.org
as described on this page:

https://wiki.documentfoundation.org/Development/Developers#Example_Statement

feel free to add an entry for yourself on the page too.
Comment 3 ulkitz 2013-12-09 08:51:59 UTC
As far as I can see, the locking is  also fixed. Seems that the ctor closes the file.
Comment 4 Commit Notification 2013-12-09 14:06:15 UTC
Ulrich Kitzinger committed a patch related to this issue.
It has been pushed to "master":

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

fdo#72156: GraphicObject: Added missing delete of stream



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 5 Commit Notification 2013-12-09 14:08:34 UTC
Ulrich Kitzinger committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f7b42987c4247244b23f0405fc5af58a92afd945&h=libreoffice-4-2

fdo#72156: GraphicObject: Added missing delete of stream


It will be available in LibreOffice 4.2.

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 Commit Notification 2013-12-09 14:19:10 UTC
Ulrich Kitzinger committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=37ed490fd7bfef1863b26d0f791cba1a04811459&h=libreoffice-4-1

fdo#72156: GraphicObject: Added missing delete of stream


It will be available in LibreOffice 4.1.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.
Comment 7 Commit Notification 2013-12-09 16:51:19 UTC
Ulrich Kitzinger committed a patch related to this issue.
It has been pushed to "libreoffice-4-1-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fffa2b69209f9c1387a6182ca1422aa3f71c1cae&h=libreoffice-4-1-4

fdo#72156: GraphicObject: Added missing delete of stream


It will be available already in LibreOffice 4.1.4.

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.