Author Topic: ThreadSearch-plugin uses cbMessageBox from inside thread  (Read 6200 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
ThreadSearch-plugin uses cbMessageBox from inside thread
« on: February 03, 2008, 02:06:26 pm »
I found another issue in ThreadSearch-plugin when I searched into C::B projectfile on Linux.
The project includes some .ico-files which could not be opened by wxTextFile.
If that happens a cbMessageBox with en error-message is shown.
This works sometimes, but sometimes hangs or crashes C::B.
This happens because the MessageBoxes are shown from inside the Thread what is not allowed.
I patched the plugin not to directly show the error-message, but send an error-event that can be handled outside the thread.

The patch has a size of about 13 kb, so I attached it as 7.z-file.

@dje
It is a Linux diff-file.
If you need a patch-file for Tortoise-svn I can try to create one.

Edit:
I removed the attached patch, because it has two missing "break"s and does not work properly on Windows.
A newer version (this time for Tortoise-SVN) is attached to a later post.
« Last Edit: February 05, 2008, 01:32:06 am by jens »

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch-plugin uses cbMessageBox from inside thread
« Reply #1 on: February 03, 2008, 06:07:17 pm »
Thanks again Jens !
I missed that point...  :oops:

It is a Linux diff-file.
If you need a patch-file for Tortoise-svn I can try to create one.
I'll try without ! It seems that TortoiseSVN accept both extensions.

Dje

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch-plugin uses cbMessageBox from inside thread
« Reply #2 on: February 04, 2008, 08:57:49 pm »
Hi Jens !

I can't apply the patch. The error message I get from TortoiseSVN is :
Code
The line "Index: " was not found!
Either it is not a diff file or the diff is empty.

Quote
If you need a patch-file for Tortoise-svn I can try to create one.
Could you pease generate this file ?

Dje

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: ThreadSearch-plugin uses cbMessageBox from inside thread
« Reply #3 on: February 05, 2008, 01:25:35 am »
Hi Jens !

I can't apply the patch. The error message I get from TortoiseSVN is :
Code
The line "Index: " was not found!
Either it is not a diff file or the diff is empty.

Quote
If you need a patch-file for Tortoise-svn I can try to create one.
Could you pease generate this file ?

Dje

Hi dje,

sorry it took a little more time, then I expected, but after copying the patched files to my virtual W2K and creating the Tortoise-SVN patch file, I tested the code on Windows and ... it doesn't work as expected.
Many windows with the same error message popped up.
So I patched my patch, and now it works on Windows and Linux (tested on debian unstable 64-bit and W2K on virtual 32-bit with kvm).

The new patch (for Tortoise-SVN) is attached to this post.

[attachment deleted by admin]
« Last Edit: February 05, 2008, 07:04:27 am by jens »

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch-plugin uses cbMessageBox from inside thread
« Reply #4 on: February 05, 2008, 08:03:53 am »
Thanks !

I'll build apply tonight (in France) !

Dje

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: ThreadSearch-plugin uses cbMessageBox from inside thread
« Reply #5 on: February 07, 2008, 11:22:38 pm »
Hi Jens !

I applied your patch.
A very big thanks, this bug was not an easy one !
I just changed
Code
int FindInFile(const wxString& filePath, wxArrayString &foundLines);
by
Code
eFileSearcherReturn FindInFile(const wxString& filePath, wxArrayString &foundLines);

Dje

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: ThreadSearch-plugin uses cbMessageBox from inside thread
« Reply #6 on: February 08, 2008, 12:45:49 am »
I just changed
Code
int FindInFile(const wxString& filePath, wxArrayString &foundLines);
by
Code
eFileSearcherReturn FindInFile(const wxString& filePath, wxArrayString &foundLines);

It is more readable and should be more type-safe (at least at compile-time) then a pure int.