Changeset 297 for ExceptionLogger
- Timestamp:
- Nov 16, 2011, 7:28:20 AM (13 years ago)
- Location:
- ExceptionLogger
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ExceptionLogger/Demo
- Property svn:ignore
-
old new 1 1 lib 2 2 Demo 3 Demo.exe
-
- Property svn:ignore
-
ExceptionLogger/Demo/Demo.lpi
r281 r297 38 38 </Item2> 39 39 </RequiredPackages> 40 <Units Count=" 7">40 <Units Count="8"> 41 41 <Unit0> 42 42 <Filename Value="Demo.lpr"/> 43 43 <IsPartOfProject Value="True"/> 44 44 <UnitName Value="Demo"/> 45 <EditorIndex Value=" 1"/>45 <EditorIndex Value="2"/> 46 46 <WindowIndex Value="0"/> 47 47 <TopLine Value="1"/> … … 59 59 <EditorIndex Value="0"/> 60 60 <WindowIndex Value="0"/> 61 <TopLine Value=" 34"/>62 <CursorPos X=" 3" Y="47"/>61 <TopLine Value="14"/> 62 <CursorPos X="1" Y="27"/> 63 63 <UsageCount Value="20"/> 64 64 <Loaded Value="True"/> … … 68 68 <Filename Value="/usr/lib64/lazarus/components/codetools/codetools.pas"/> 69 69 <UnitName Value="CodeTools"/> 70 <EditorIndex Value="3"/>71 70 <WindowIndex Value="0"/> 72 71 <TopLine Value="4"/> 73 72 <CursorPos X="32" Y="15"/> 74 73 <UsageCount Value="10"/> 75 <Loaded Value="True"/>76 74 </Unit2> 77 75 <Unit3> … … 89 87 <ResourceBaseClass Value="Form"/> 90 88 <UnitName Value="UExceptionForm"/> 91 <EditorIndex Value=" 4"/>89 <EditorIndex Value="3"/> 92 90 <WindowIndex Value="0"/> 93 91 <TopLine Value="83"/> … … 100 98 <Unit5> 101 99 <Filename Value="../ReadMe.txt"/> 102 <EditorIndex Value=" 5"/>100 <EditorIndex Value="4"/> 103 101 <WindowIndex Value="0"/> 104 102 <TopLine Value="1"/> … … 110 108 <Unit6> 111 109 <Filename Value="/usr/share/fpcsrc/rtl/inc/objpash.inc"/> 112 <EditorIndex Value="2"/>113 110 <WindowIndex Value="0"/> 114 111 <TopLine Value="171"/> 115 112 <CursorPos X="23" Y="185"/> 116 113 <UsageCount Value="10"/> 117 <Loaded Value="True"/>118 114 </Unit6> 115 <Unit7> 116 <Filename Value="../UExceptionLogger.pas"/> 117 <UnitName Value="UExceptionLogger"/> 118 <EditorIndex Value="1"/> 119 <WindowIndex Value="0"/> 120 <TopLine Value="228"/> 121 <CursorPos X="23" Y="233"/> 122 <UsageCount Value="10"/> 123 <Loaded Value="True"/> 124 <DefaultSyntaxHighlighter Value="Delphi"/> 125 </Unit7> 119 126 </Units> 120 <JumpHistory Count=" 17" HistoryIndex="16">127 <JumpHistory Count="22" HistoryIndex="21"> 121 128 <Position1> 122 129 <Filename Value="UMainForm.pas"/> … … 128 135 </Position2> 129 136 <Position3> 130 <Filename Value=" /usr/lib64/lazarus/components/codetools/codetools.pas"/>131 <Caret Line="1 " Column="1" TopLine="1"/>137 <Filename Value="UMainForm.pas"/> 138 <Caret Line="18" Column="28" TopLine="9"/> 132 139 </Position3> 133 140 <Position4> 134 <Filename Value=" /usr/lib64/lazarus/components/codetools/codetools.pas"/>135 <Caret Line=" 32" Column="1" TopLine="4"/>141 <Filename Value="../UExceptionForm.pas"/> 142 <Caret Line="13" Column="1" TopLine="1"/> 136 143 </Position4> 137 144 <Position5> 138 145 <Filename Value="UMainForm.pas"/> 139 <Caret Line="1 8" Column="28" TopLine="9"/>146 <Caret Line="19" Column="65" TopLine="9"/> 140 147 </Position5> 141 148 <Position6> 142 149 <Filename Value="../UExceptionForm.pas"/> 143 <Caret Line=" 13" Column="1" TopLine="1"/>150 <Caret Line="88" Column="1" TopLine="83"/> 144 151 </Position6> 145 152 <Position7> 146 <Filename Value=" UMainForm.pas"/>147 <Caret Line=" 19" Column="65" TopLine="9"/>153 <Filename Value="../UExceptionForm.pas"/> 154 <Caret Line="89" Column="1" TopLine="83"/> 148 155 </Position7> 149 156 <Position8> 150 <Filename Value=" ../UExceptionForm.pas"/>151 <Caret Line=" 88" Column="1" TopLine="83"/>157 <Filename Value="UMainForm.pas"/> 158 <Caret Line="19" Column="65" TopLine="9"/> 152 159 </Position8> 153 160 <Position9> 154 <Filename Value=" ../UExceptionForm.pas"/>155 <Caret Line=" 89" Column="1" TopLine="83"/>161 <Filename Value="UMainForm.pas"/> 162 <Caret Line="21" Column="65" TopLine="9"/> 156 163 </Position9> 157 164 <Position10> 158 165 <Filename Value="UMainForm.pas"/> 159 <Caret Line="1 9" Column="65" TopLine="9"/>166 <Caret Line="16" Column="33" TopLine="1"/> 160 167 </Position10> 161 168 <Position11> 162 169 <Filename Value="UMainForm.pas"/> 163 <Caret Line=" 21" Column="65" TopLine="9"/>170 <Caret Line="57" Column="10" TopLine="33"/> 164 171 </Position11> 165 172 <Position12> 166 173 <Filename Value="UMainForm.pas"/> 167 <Caret Line=" 16" Column="33" TopLine="1"/>174 <Caret Line="56" Column="30" TopLine="34"/> 168 175 </Position12> 169 176 <Position13> 170 177 <Filename Value="UMainForm.pas"/> 171 <Caret Line="5 7" Column="10" TopLine="33"/>178 <Caret Line="54" Column="4" TopLine="34"/> 172 179 </Position13> 173 180 <Position14> 174 <Filename Value=" UMainForm.pas"/>175 <Caret Line=" 56" Column="30" TopLine="34"/>181 <Filename Value="Demo.lpr"/> 182 <Caret Line="6" Column="16" TopLine="1"/> 176 183 </Position14> 177 184 <Position15> 178 <Filename Value=" UMainForm.pas"/>179 <Caret Line=" 54" Column="4" TopLine="34"/>185 <Filename Value="Demo.lpr"/> 186 <Caret Line="8" Column="14" TopLine="1"/> 180 187 </Position15> 181 188 <Position16> 182 <Filename Value=" Demo.lpr"/>183 <Caret Line=" 6" Column="16" TopLine="1"/>189 <Filename Value="../UExceptionLogger.pas"/> 190 <Caret Line="21" Column="43" TopLine="14"/> 184 191 </Position16> 185 192 <Position17> 186 <Filename Value=" Demo.lpr"/>187 <Caret Line=" 8" Column="14" TopLine="1"/>193 <Filename Value="UMainForm.pas"/> 194 <Caret Line="47" Column="44" TopLine="35"/> 188 195 </Position17> 196 <Position18> 197 <Filename Value="UMainForm.pas"/> 198 <Caret Line="48" Column="44" TopLine="36"/> 199 </Position18> 200 <Position19> 201 <Filename Value="UMainForm.pas"/> 202 <Caret Line="67" Column="1" TopLine="45"/> 203 </Position19> 204 <Position20> 205 <Filename Value="UMainForm.pas"/> 206 <Caret Line="24" Column="34" TopLine="1"/> 207 </Position20> 208 <Position21> 209 <Filename Value="UMainForm.pas"/> 210 <Caret Line="39" Column="1" TopLine="32"/> 211 </Position21> 212 <Position22> 213 <Filename Value="UMainForm.pas"/> 214 <Caret Line="38" Column="1" TopLine="31"/> 215 </Position22> 189 216 </JumpHistory> 190 217 </ProjectOptions> 191 218 <CompilerOptions> 192 <Version Value="1 0"/>219 <Version Value="11"/> 193 220 <Target> 194 221 <Filename Value="Demo"/> … … 208 235 <Linking> 209 236 <Debugging> 210 <GenerateDebugInfo Value="True"/>211 237 <DebugInfoType Value="dsStabs"/> 212 238 </Debugging> -
ExceptionLogger/UExceptionLogger.pas
r265 r297 10 10 11 11 type 12 TThreadSynchronizeEvent = procedure (AObject: TObject; Method: TThreadMethod) of object; 12 13 13 14 { TExceptionLogger } … … 17 18 FMaxCallStackDepth: Integer; 18 19 FLogFileName: string; 20 FOnThreadSynchronize: TThreadSynchronizeEvent; 21 procedure ThreadSynchronize(AObject: TObject; Method: TThreadMethod); 19 22 function GetAppVersion: string; 20 23 procedure SetMaxCallStackDepth(const AValue: Integer); … … 37 40 property LogFileName: string read FLogFileName write FLogFileName; 38 41 property MaxCallStackDepth: Integer read FMaxCallStackDepth write SetMaxCallStackDepth; 42 property OnThreadSynchronize: TThreadSynchronizeEvent read FOnThreadSynchronize 43 write FOnThreadSynchronize; 39 44 end; 40 45 … … 63 68 SProcedureMethod = 'Procedure/method'; 64 69 SUnit = 'Unit'; 70 SExceptionHandlerCannotBeSynchronized = 'Exception handler cannot be synchronized with main thread.'; 65 71 66 72 implementation … … 84 90 Application.OnException := ExceptionHandler; 85 91 Application.Flags := Application.Flags - [AppNoExceptionMessages]; 92 OnThreadSynchronize := ThreadSynchronize; 86 93 end; 87 94 … … 162 169 LastException := E; 163 170 ExceptionSender := Sender; 164 if ExceptionSender is TThread then 165 TThread.Synchronize(TThread(ExceptionSender), ShowForm) 166 else ShowForm; 171 if (MainThreadID <> ThreadID) then begin 172 if Assigned(FOnThreadSynchronize) then 173 FOnThreadSynchronize(Sender, ShowForm) 174 else raise Exception.Create(SExceptionHandlerCannotBeSynchronized); 175 end else ShowForm; 167 176 end; 168 177 … … 209 218 FMaxCallStackDepth := AValue; 210 219 StackTrace.MaxDepth := AValue; 220 end; 221 222 procedure TExceptionLogger.ThreadSynchronize(AObject: TObject; 223 Method: TThreadMethod); 224 begin 225 if AObject is TThread then TThread.Synchronize(TThread(AObject), Method) 226 else raise Exception.Create(SExceptionHandlerCannotBeSynchronized); 211 227 end; 212 228 -
ExceptionLogger/languages/UExceptionLogger.cs.po
r295 r297 43 43 msgid "Class" 44 44 msgstr "Třída" 45 46 #: uexceptionlogger.sexceptionhandlercannotbesynchronized 47 msgid "Exception handler cannot be synchronized with main thread." 48 msgstr "Obsluha vyjímky nemůže být synchronizována s hlavním vláknem." 45 49 46 50 #: uexceptionlogger.sexceptioninfo -
ExceptionLogger/languages/UExceptionLogger.po
r295 r297 34 34 msgctxt "uexceptionlogger.sexceptionclass" 35 35 msgid "Class" 36 msgstr "" 37 38 #: uexceptionlogger.sexceptionhandlercannotbesynchronized 39 msgid "Exception handler cannot be synchronized with main thread." 36 40 msgstr "" 37 41
Note:
See TracChangeset
for help on using the changeset viewer.