Bug 290652 - Segfaults when opening the image viewer [patch]
Summary: Segfaults when opening the image viewer [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Portability-Runtime (show other bugs)
Version: 2.4.1
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-05 00:25 UTC by Brad Hubbard
Modified: 2017-08-18 14:15 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.0.0


Attachments
First alternative patch using isInitialized member variable (1.61 KB, patch)
2012-01-05 00:25 UTC, Brad Hubbard
Details
Second alternative patch using existing firstImage member variable (1.46 KB, patch)
2012-01-05 00:26 UTC, Brad Hubbard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Hubbard 2012-01-05 00:25:20 UTC
Created attachment 67469 [details]
First alternative patch using isInitialized member variable

Version:           2.4.1 (using KDE 4.7.4) 
OS:                Linux

Steps to Reproduce:
1.Open gwenview
2.Go to Plug-in  
3.then tools
4.OpenGL image viewer

Reproducible: Always

Steps to Reproduce:
See above

Actual Results:  
segfault

Expected Results:  
No segfault but not sure about exactly what should happen?

I have created two possible solutions (patches) to this issue and will attach them. I can provide a core if required.

That problem is caused by the fact that when the menu item is clicked with no
image open a ViewerWidget is instantiated but ViewerWidget::initializeGL()
never gets called and the tex member variable (GLuint[3]) is not initialized
properly. When the destructor is invoked it calls glDeleteTextures(1,tex) and
crashes when accessing the invalid tex. My first patch uses a dedicated
variable (isInitialized) to represent the initialized state and is more
intuitive IMHO. The second approach is more economical and uses an existing
member variable (firstImage) to accomplish the same. This required moving some
of the code in the constructor that should have no side effects but this
approach is less intuitive and maybe prone to the problems of using one
mechanism to accomplish multiple objectives?
Comment 1 Brad Hubbard 2012-01-05 00:26:00 UTC
Created attachment 67470 [details]
Second alternative patch using existing firstImage member variable
Comment 2 caulier.gilles 2012-06-22 08:55:50 UTC
Official Kipi-plugins 2.6.0 release is out since few days now :

http://www.digikam.org/drupal/node/656

Please, check if this entry still valid, or update report accordingly.

Thanks in advance.

Gilles Caulier
Comment 3 Brad Hubbard 2013-01-02 00:34:26 UTC
Can't reproduce this with kipi-plugins-2.9.0-3