keepass2 (2.16+dfsg-2) crashes switching tabs

Bug #891029 reported by Sven Steiner
32
This bug affects 7 people
Affects Status Importance Assigned to Milestone
keepass2 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

i open 2 databases, one local db an one located on a webdav.

first i open my local db for my webdav-keepass password. then i open the database located on the webdav (first mounted to the local filesystem). everything works, i can use the passes, can make new entries and so on...
if i have to switch to my local database for my private passes, everything works. but then, when i switch back to the webdav-mounted database, keepass2 crashes with the following error:
System.Exception: Generic Error [GDI+ status: GenericError]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0
  at System.Drawing.Graphics.FillRectangle (System.Drawing.Brush brush, Int32 x, Int32 y, Int32 width, Int32 height) [0x00000] in <filename unknown>:0
  at System.Drawing.Graphics.FillRectangle (System.Drawing.Brush brush, Rectangle rect) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Drawing.Graphics:FillRectangle (System.Drawing.Brush,System.Drawing.Rectangle)
  at System.Windows.Forms.Control.PaintControlBackground (System.Windows.Forms.PaintEventArgs pevent) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.OnPaintBackground (System.Windows.Forms.PaintEventArgs pevent) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ScrollableControl.OnPaintBackground (System.Windows.Forms.PaintEventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.TabPage.OnPaintBackground (System.Windows.Forms.PaintEventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0

System-Informations:
Ubuntu-Release: Ubuntu 11.10
keepass2:
  Installiert: 2.16+dfsg-2
Mono JIT compiler version 2.10.5 (Debian 2.10.5-1)

Revision history for this message
Julian Taylor (jtaylor) wrote :

that looks an awful lot like this bug:
http://sourceforge.net/projects/keepass/forums/forum/329221/topic/4519750

I though I "fixed" that :/
thanks for the report I'll have another look.

Revision history for this message
Julian Taylor (jtaylor) wrote :

It still works for me.
does it also happen with local databases or is it specific to webdav stored ones?
what are the file names of the databases (the ones displayed in the tabs)?

Changed in keepass2 (Ubuntu):
status: New → Incomplete
Revision history for this message
Sven Steiner (siq) wrote :
Download full text (5.5 KiB)

thx for your reply :)

first the filenames: passes-sam.kdbx & secotrust.kdbx

today i tested a few things to see what could it be, it seems that there is no problem with the webdav store.
new test-databases on the webdav, with keyfile or without keyfile show no problems.
but the strange think:
my important database (this one on the webdav store) in combination with the keyfile also produce this error on the local filesystem.

what i tested:

- open my personal db (local db file, keyfile, name: passes-sam.kdbx) and then create a new database on the webdav store with an local keyfile: no problems, i can switch the tabs, i can save, everything works
- i create a new database, same passwort like my important database, on the webdav store with local keyfile 256bit, everything works

- open my webdav db (secotrust.kdbx, local keyfile) an then open my personal db, switch the tab -> the posted error
- copy my webdav-db to the local filesystem, same folder with keyfile, open the database, then create a new database, switch the tab -> error
- create a new database with my important keyfile and the same passwort, no problem, everything works

But when i syncronize my existing important database to a new created, working database, i got the same error on the new database-file. result: i open my personal-database, then my test.kdbx (with the same entries, synced with the db located on the webdav-store), switch the tabs, the error occured.
Meanwhile testing i had 2 time to reboot my Workstation. After a few tests the error went bigger and keepass didnt start anymore, i had to reboot for make keepass working :(

the full error befor keepass cant start anymore:
System.Exception: Generic Error [GDI+ status: GenericError]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0
  at System.Drawing.Graphics.FillRectangle (System.Drawing.Brush brush, Int32 x, Int32 y, Int32 width, Int32 height) [0x00000] in <filename unknown>:0
  at System.Drawing.Graphics.FillRectangle (System.Drawing.Brush brush, Rectangle rect) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Drawing.Graphics:FillRectangle (System.Drawing.Brush,System.Drawing.Rectangle)
  at System.Windows.Forms.Control.PaintControlBackground (System.Windows.Forms.PaintEventArgs pevent) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.OnPaintBackground (System.Windows.Forms.PaintEventArgs pevent) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ScrollableControl.OnPaintBackground (System.Windows.Forms.PaintEventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.TabPage.OnPaintBackground (System.Windows.Forms.PaintEventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message&...

Read more...

Revision history for this message
Sven Steiner (siq) wrote :

what will we do, do you have older/newer/other deb-files for me so we can test other releases?

Revision history for this message
Julian Taylor (jtaylor) wrote :

you could try increasing the tabbar height a bit more, that solved the issue for me.
You need to patch and recompile the program to do so:

apt-get install devscripts equivs
apt-get source keepass2
cd keepass2-2.16
sudo mk-build-deps -i -r

# edit KeePass/Forms/MainForm.cs ~ line 113, the number in this line a bit:
# m_tabMain.Height += 3;

debuild -us -uc
# install
sudo debi ../keepass2*changes
#test

to remove the build dependencies again do apt-get autoremove keepass2-build-deps

Revision history for this message
Sven Steiner (siq) wrote :

you are my hero :)

after increasing the m_tabMain.Heigh (m_tabMain.Height += 5;) my keepass2 is working now :)

I'm happy and very excited about your support.

Thank you!

Julian Taylor (jtaylor)
Changed in keepass2 (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Julian Taylor (jtaylor) wrote :

the tab height was increased by 5 in the 2.18 release available in precise.

Changed in keepass2 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Alan Reyes (kuttkatrea) wrote :

Still happening in Ubuntu 13.10.

Testing with mono 3.2.5, we get (at last!) a better error message:

Cannot add Control to TabControl. Only TabPages can be directly added to TabControls.
System.Windows.Forms
  at System.Windows.Forms.TabControl+ControlCollection.Add (System.Windows.Forms.Control value) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.set_Parent (System.Windows.Forms.Control value) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control..ctor (System.Windows.Forms.Control parent, System.String text) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor (System.Windows.Forms.Control,string)
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.XplatUIX11.DispatchMessage (System.Windows.Forms.MSG& msg) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.XplatUI.DispatchMessage (System.Windows.Forms.MSG& msg) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Windows.Forms.ApplicationContext context) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) [0x00000] in <filename unknown>:0
  at KeePass.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Void Add(System.Windows.Forms.Control)

Regards

Revision history for this message
Alexander Hartmaier (alex-hartmaier) wrote :

Same here on Ubuntu 13.10:

System.Exception: Generic Error [GDI+ status: GenericError]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0
  at System.Drawing.Graphics.FillRectangle (System.Drawing.Brush brush, Int32 x, Int32 y, Int32 width, Int32 height) [0x00000] in <filename unknown>:0
  at System.Drawing.Graphics.FillRectangle (System.Drawing.Brush brush, Rectangle rect) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Drawing.Graphics:FillRectangle (System.Drawing.Brush,System.Drawing.Rectangle)
  at System.Windows.Forms.Control.PaintControlBackground (System.Windows.Forms.PaintEventArgs pevent) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.OnPaintBackground (System.Windows.Forms.PaintEventArgs pevent) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ScrollableControl.OnPaintBackground (System.Windows.Forms.PaintEventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.TabPage.OnPaintBackground (System.Windows.Forms.PaintEventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0

Revision history for this message
Alan Reyes (kuttkatrea) wrote :

This problem persist with mono 3.2.8, but debugging the source code and reading other's bug reports I found, it seems this problem is a bug in the Mono Framework when using images in the Tab pages, because it don't happens when you don't use custom colors.

So, I propose as a workaround to add a setting to "ignore custom colors" so this problem can be averted without removing the custom colors for those who work in multiple operative sistems.

Regards.

Revision history for this message
David Lechner (dlech) wrote :

I beleive this is fixed in KeePass 2.27, which you can get from here: https://launchpad.net/~jtaylor/+archive/ubuntu/keepass

Revision history for this message
Michisteiner (michisteiner) wrote :

@David, i don't know about 2.27, but the fatal error as in #8 still happens with that ppa and 2.28. And, no custom colors are involved (or at least i didsabled them again ...)

Revision history for this message
Michisteiner (michisteiner) wrote :

(BTW: the dbs involved are all local ...)

Revision history for this message
Robert Frittmann (frittmann) wrote :
Download full text (7.5 KiB)

I can confirm that I am experiencing the same bug with KeePass v2.28 under Mono v3.2.8 on Lubuntu v14.04. I am using two local dbs and one of them has a custom colour. I tested it with two dbs without the custom colour, and it worked fine on changing tabs without crashing. Then I added the third db which has a custom colour and it crashed on changing tabs with the following error message:

System.ArgumentException: Cannot add Control to TabControl. Only TabPages can be directly added to TabControls.
  at System.Windows.Forms.TabControl+ControlCollection.Add (System.Windows.Forms.Control value) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.set_Parent (System.Windows.Forms.Control value) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control..ctor (System.Windows.Forms.Control parent, System.String text) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor (System.Windows.Forms.Control,string)
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.XplatUIX11.DispatchMessage (System.Windows.Forms.MSG& msg) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.XplatUIX11.DoEvents () [0x00000] in <filename unknown>:0
  at System.Windows.Forms.XplatUI.DoEvents () [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Application.DoEvents () [0x00000] in <filename unknown>:0
  at System.Windows.Forms.TreeView.EndEdit (System.Windows.Forms.TreeNode node) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.TreeView.VScrollBarValueChanged (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ScrollBar.OnValueChanged (System.EventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ScrollBar.set_Value (Int32 value) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.ScrollBar:set_Value (int)
  at System.Windows.Forms.TreeView.SetVScrollValue (Int32 value) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.TreeView.SetTop (System.Windows.Forms.TreeNode node) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TreeView:SetTop (System.Windows.Forms.TreeNode)
  at System.Windows.Forms.TreeNode.EnsureVisible () [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TreeNode:EnsureVisible ()
  at System.Windows.Forms.TreeView.set_SelectedNode (System.Windows.Forms.TreeNode value) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TreeView:set_SelectedNode (System.Windows.Forms.TreeNode)
  at KeePass.Forms.MainForm.UpdateGroupList (KeePassLib.PwGroup pgNewSelected) [0x00000] in <filename unknown>:0
  at KeePass.Forms.MainForm.UpdateUI (Boolean bRecreateTabBar, KeePass.UI.PwDocument dsSelect, Boolean bUpdateGroupList, KeePassLib.PwGroup pgSelect, Boolean bUpdateEntryList, KeePassLib.PwGroup pgEntrySource, Boolean bSetModified, System.Windows.Forms.Control cOptFocus) [0x00000] in <filen...

Read more...

Revision history for this message
Giorgio Premi (giosh94mhz) wrote :

Confirm the same error happens to me with Keepass 2.25 and mono 3.2.8.

This ONLY happens when using custom colors as stated here https://sourceforge.net/p/keepass/bugs/1256/

After removing my (beloved) custom color from the database, everything seems stable.

Revision history for this message
David Lechner (dlech) wrote :

This has been fixed. Upgrade to a newer version of KeePass.

Revision history for this message
Paddy Landau (paddy-landau) wrote :

Unfortunately, I still get this error — no custom colours used.

Reference
https://sourceforge.net/p/keepass/bugs/1634/

Revision history for this message
Paddy Landau (paddy-landau) wrote :

@jtaylor I followed your instructions in comment #5 but using +=10 instead of +=5, and this worked for me! I can even use customised tab colours.

It seems that the value needs to be rather larger than originally anticipated.

BTW, do you think that the KeePass PPA will be updated any time soon to the latest version? Thank you.

Revision history for this message
Julian Taylor (jtaylor) wrote :

good to know, I'll check if I can increase it more in the package.
Debian thawed yesterday so the update will be coming soon.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.